I
IchBin
There was a person learning Java and posted a question about an error
that he was getting in a program. The code was from a book he was
learning from. He did not mention this before hand. I did not test it
and said the you can not call a method with a variable argument list
for a method <below>.
To my amazement this variable argument list is legal. I know the the
For-loop came out in 1.5 but can not find anything about a variable
argument list for a method. I do not see it in the Java Language Specs
nor in the tutorials. When was this initially implemented in Java and
where is it documented.
printAll(2,"two",4,"Four",4.5,"Four Point Five");
printAll( );
printAll(25,"Anything Goes",4E4,false);
public static void printAll(Object ... args){ // Error Here
for(Object a:args){ // Error Here
System.out.println(a);
}
--
Thanks in Advance... http://ichbinquotations.awardspace.com
IchBin, Pocono Lake, Pa, USA http://ichbin.9999mb.com
______________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
that he was getting in a program. The code was from a book he was
learning from. He did not mention this before hand. I did not test it
and said the you can not call a method with a variable argument list
for a method <below>.
To my amazement this variable argument list is legal. I know the the
For-loop came out in 1.5 but can not find anything about a variable
argument list for a method. I do not see it in the Java Language Specs
nor in the tutorials. When was this initially implemented in Java and
where is it documented.
printAll(2,"two",4,"Four",4.5,"Four Point Five");
printAll( );
printAll(25,"Anything Goes",4E4,false);
public static void printAll(Object ... args){ // Error Here
for(Object a:args){ // Error Here
System.out.println(a);
}
--
Thanks in Advance... http://ichbinquotations.awardspace.com
IchBin, Pocono Lake, Pa, USA http://ichbin.9999mb.com
______________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)