Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

K&B Mock Exam Question

 
Anthony Zepezauer
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 513
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"No arguments" is a valid value for a varargs parameter. The constructor will simply be called with an array of length 0.
 
Anthony Zepezauer
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ohhhhh. Thanks Kelvin.
 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!