开发者

SCJP - exam question

It's actually from SCJP 6 StudyGuide Exam310-065(MGH,2008) alt text http://www.freeimagehosting.net/uploads/1f37466409.png alt text http://www.freeimagehosting.net/uploads/03aaff252a.png alt text http://www.freeimagehosting.net/uploads/b56385a448.png alt text http://www.freeimagehosting.net/uploads/83761fff86.png

The call to super() in Kinder class constructor seems to be redundant because of:

  • quote from the book: alt text http://www.freeimagehosting.net/uploads/8984096dc6.png i.e. 开发者_JAVA百科that there is no need to type super() explicitly, as this can be done by compiler
  • the compiler accepts very well version without call to super()

The question is, if authors made some mistake in this question or am I missing something (more likely)


Sorry, I may be missing something (most likely), but it sounds like it's stated in the text:

a. The line cannot be left blank, as the parentheses are already in place.

That is, a constructor can be empty.. except that empty parentheses would be a syntax error (so it wouldn't compile).

b. Further, since the superclass constructor called is the no-argument version, this constructor must be created.

I think you may just have to re-read the text one more time and it should all click. Or I am really off on the whole thing.. in that case I apologize, it's kind of late over here. ;-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜