R
Reinert Korsnes
Newbie Java question (my main progamming experience is Ada95):
How do I make a new array (A) of length N and at the same time initiate it ?
I can do it this way:
------------------------------------------------
A = new int [N);
for (int i=0; i < A.length; i++){
A = 1;
}
------------------------------------------------
But I find it clumsy.
In Ada one can use:
A : array (0..N) of Integer := (others=>1);
Something I have been missing ?
Possible to do the java version short, elegant and readable/relyable ?
reinert
How do I make a new array (A) of length N and at the same time initiate it ?
I can do it this way:
------------------------------------------------
A = new int [N);
for (int i=0; i < A.length; i++){
A = 1;
}
------------------------------------------------
But I find it clumsy.
In Ada one can use:
A : array (0..N) of Integer := (others=>1);
Something I have been missing ?
Possible to do the java version short, elegant and readable/relyable ?
reinert