gpt4 book ai didi

Java MultiChoice,2 个错误答案?

转载 作者:太空宇宙 更新时间:2023-11-04 10:57:05 25 4
gpt4 key购买 nike

Which one of the following is false about classes and inheritance in Java?

a) The sub class can have a method with the same name as the super class.
b) A sub class can inherit from only one super class by using the keyword “implements”.
c) In Java, classes can be derived from other classes, in order to create more complex relationships.
d) A sub class cannot have more attributes than its super class.

我的猜测是 d,但 b 似乎也是错误的。父类(super class)可以称为接口(interface)吗?我认为子类“扩展”父类(super class),而类“实现”接口(interface)。那么问题中为什么使用“implements”呢?

这个问题我也遇到了麻烦。

Which of the following is correct terminology about inheritance in Java?

A) We extend from a base class and implement a subclass
B) We implement a base class and extend from an interface
C) We extend from a subclass and implement a base class
D) We implement from a subclass and extend an interface

我的猜测是 C,但这只是一个有根据的猜测。如果有解释就太好了!

谢谢

最佳答案

接口(interface)不是类。一个子类可以有更多的属性,这是很自然的事情。想象一下父类(super class) Person 和子类 Student extends Person学生的属性应该比少吗?

关于Java MultiChoice,2 个错误答案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47260684/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com