Ok I have to be missing something here but I've gone over and over it and just can't see it. Here's a question from the mock exam on the CD that came with K&B (line numbers added by me):
I selected the "Does not compile" option, because:
* line 11 is calling a no-args constructor; * there is a constructor with args defined on line 6, therefore there will be no default constructor supplied; * no no-args constructor is explicitly defined.
But I was wrong, I tried it and this code does compile and run. What am I missing??? Any help is appreciated.
[ November 09, 2007: Message edited by: Anthony Zepezauer ] [ November 09, 2007: Message edited by: Anthony Zepezauer ]
Kelvin Chenhao Lim
posted 8 years ago
"No arguments" is a valid value for a varargs parameter. The constructor will simply be called with an array of length 0.