| Author |
How to initialize array dynamically?
|
Amruta Joshi
Greenhorn
Joined: Jul 08, 2005
Posts: 1
|
|
HI, How to initializa array at run time without using for loop.? I there any other method for that?
|
 |
Mani Ram
Ranch Hand
Joined: Mar 11, 2002
Posts: 1140
|
|
With out a loop!? One Way: Another Way: You can use the fill() method in java.util.Arrays class, (but it internally uses a loop to assign the values). Yet Another Way: You can use while loops, if you don't want to use for loop  [ July 08, 2005: Message edited by: Mani Ram ]
|
Mani
Quaerendo Invenietis
|
 |
Amol Fuke
Ranch Hand
Joined: Apr 08, 2005
Posts: 129
|
|
Amruta, You can use something like this: double[][] xAxisValues = new double[xValuesList.size()][]; This will initialize array xAxisValues of size xValuesList.size() where xValuesList is arraylist.
|
"There are no mistakes, only lessons"
|
 |
Georgy Bolyuba
Ranch Hand
Joined: Feb 18, 2005
Posts: 162
|
|
I did it my way (c): [ July 08, 2005: Message edited by: George Bolyuba ]
|
SCJP 1.4 (100%) Done.<br />SCJD (URLyBird 1.2.3 Started)
|
 |
 |
|
|
subject: How to initialize array dynamically?
|
|
|