Find the error(s) in the following code. The following method should create a new Shape object with numberSides sides.
```
1 private void manipulateShape( int numberSides )
2 {
3 Shape shape = new Shape( 3 );
4
5 shape.sides = numberSides;
6 }
```
The instance variable sides of class Shape is private so its value cannot be set directly as line 5 attempts to do. Line 5 should be changed to shape.setSides( number- Sides ); to properly set the value of sides.
```
1 private void manipulateShape( int numberSides )
2 {
3 Shape shape = new Shape( 3 );
4
5 shape.setSides( numberSides );
6 }
```
You might also like to view...
A ________ loop is a good way to step through the elements of an array and perform some program action on each indexed variable.
a. while b. do…while c. for d. all of the above
Which of the following Web sites used to access digital media was developed by Apple?
A. Flickr B. YouTube C. iTunes D. Hulu
Which of the following is NOT true about working with files?
A. When renaming a file, keep the original file extension. B. Store programs and data files in the root directory. C. Do not mix data and program files. D. Access files from the hard drive for best performance.
A preformatted document that you can use as a starting point and then change to suit your needs
a. file b. spreadsheet c. template