Sunday, July 26, 2009

Puzzle 44 – Solution

The point to note here was that the argument type was same for all the constructor calls – namely String. Java 1.5 adds the variable arguments language feature makes it possible to call a method with a variable number of arguments. More information can be got at http://today.java.net/pub/a/today/2004/04/19/varargs.html

Declaring the constructor as ExtraLoad(String... s){} takes care that all the constructor have a definition!!

No comments:

Post a Comment

Solution for this question?