| Author |
can array size defined dynamically?
|
Davie Lin
Ranch Hand
Joined: Aug 05, 2007
Posts: 294
|
|
Hi, Happy Holiday everyone
Does anyone know if array size in Java can be defined dynamically with an integer variable.
Would be great if you can just write a couple lines of code to demonstrate if it is possible.
Thank you
|
 |
Adam Michalik
Ranch Hand
Joined: Feb 18, 2008
Posts: 128
|
|
|
Well, have you tried it? Try to create an array with statically defined size. Then, try to declare it's size as an int variable and use it as the array's size. What happens?
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
|
Yes. you can. please go through the documentation about Arrays.copyOf and System.arrayCopy
|
 |
 |
|
|
subject: can array size defined dynamically?
|
|
|