aspose file tools
The moose likes Java in General and the fly likes can array size defined dynamically? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "can array size defined dynamically?" Watch "can array size defined dynamically?" New topic
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: can array size defined dynamically?
 
Similar Threads
Question about working with arrays
Array Vs ArrayList
2D array
Such thing as dynamic array's in java?
Array vs ArrayList