SCJP-- 考试问题

发布于 2024-08-23 13:30:51 字数 1050 浏览 1 评论 0原文

它实际上来自SCJP 6 StudyGuide Exam310-065(MGH,2008) 替代文本 http://www.freeimagehosting.net/uploads/1f37466409.png 替代文本 http://www.freeimagehosting.net/uploads/03aaff252a.png 替代文本 http://www.freeimagehosting.net/uploads/b56385a448.png 替代文本 http://www.freeimagehosting.net/uploads/83761fff86.png

Kinder 类构造函数中调用 super() 似乎是多余的,因为:


问题是,如果作者在这方面犯了一些错误问题还是我错过了什么(更有可能)

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:


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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鱼忆七猫命九 2024-08-30 13:30:51

抱歉,我可能遗漏了一些东西(最有可能),但听起来就像文本中所述:

a。该行不能留空,因为括号已经就位。

也就是说,构造函数可以为空......除了空括号将是语法错误(因此它无法编译)。

b.此外,由于调用的超类构造函数是无参数版本,因此必须创建此构造函数。

我想你可能只需要再重新阅读一遍文本,就应该全部明白了。或者我真的对整个事情不感兴趣……在这种情况下,我很抱歉,这里有点晚了。 ;-)

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. ;-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文