
538 CHAPTER 8 Single-Dimensional Arrays
Figure 8.27
Opening Window of
ArrayPractice2
When you have finished writing your code, compile and run the applica-
tion. Figure 8.27 shows the graphics window when the application begins.
To test any method, click on the appropriate button.
Troubleshooting
If your method implementation does not animate, consider these tips:
■
Verify that your for loop calls the animate method as instructed in
the method comments.
■
Verify that you did not instantiate a new array. Perform all opera-
tions on the instance variable array named arr.
8.8 Using Arrays as Counters
In some circumstances, it is useful to use an array of integers ...