| Author |
Allocates number within of array.
|
Gustavo Siqueira
Ranch Hand
Joined: Jun 15, 2011
Posts: 94
|
|
Hello the all!
I want allocates number within of one array, see the program:
See the result:
Class1:
1
1
1
1
1
1
Or is, this allocating in all memory of array.
How to solved the problem ?
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
You're printing the first element (class1[0]) each time.
Also, your loop condition should be while(i < class1.length); so < and not <=. Arrays in Java start at 0 and go to the length - 1 inclusive, or the length exclusive.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Allocates number within of array.
|
|
|