| Author |
arrays in java
|
Prasanna Govindan
Greenhorn
Joined: Aug 21, 2005
Posts: 2
|
|
hi java Gurus, Please some help.... i want to create an array whose size is determined at runtime i dont want to give the dimensions of the array at declaration. for eg: int [] ary; int index=0; ary[index]=12 gives Null pointer exception. Is there any way to declare an array and not mention the size of it and insert values into it...faciliating the size to be determined at runtime. Thanks Prasanna
|
 |
Thomas Drew
Ranch Hand
Joined: Sep 15, 2004
Posts: 47
|
|
|
Array are not to be dynamic. You should use an ArrayList or Vectors.
|
 |
Victor Flores O'connor
Greenhorn
Joined: Aug 05, 2005
Posts: 2
|
|
you mean like this??? 'size' can be whatever you want at runtime
|
 |
 |
|
|
subject: arrays in java
|
|
|