avatar
f*y
1
142. Which two statements are true? (Choose Two)
A.An anonymous inner class can be declared inside of a method.
B.An anonymous inner class constructor can take arguments in some situation.
C.An anonymous inner class that is a direct subclass that is a direct subcla
ss of Object can implement multiple interfaces .
D.Even if a class Super does not implement any interfaces, it is still possi
ble to define an anonymous inner class that is an
immediate subclass of Super that implements a single inter
avatar
F*n
2
AB

【在 f****y 的大作中提到】
: 142. Which two statements are true? (Choose Two)
: A.An anonymous inner class can be declared inside of a method.
: B.An anonymous inner class constructor can take arguments in some situation.
: C.An anonymous inner class that is a direct subclass that is a direct subcla
: ss of Object can implement multiple interfaces .
: D.Even if a class Super does not implement any interfaces, it is still possi
: ble to define an anonymous inner class that is an
: immediate subclass of Super that implements a single inter

avatar
f*y
3
答案看上去是对的,
多谢分析一下。

【在 F****n 的大作中提到】
: AB
avatar
n*k
4

Should be AC, B is apparent wrong, how can an anonymous class has a
constructor, it simply can not have any constructors cause any constructor
definition need a name. So an anonymous inner class simply uses the
constructors of it's superclass. All the auguments passed in is going to
superclass. So if inner class implements an interface, it can not take any
arguments.
A. is the main reason why you may think use the inner class, lazy!!! hehe.
C. Is right, bacause any inner class is an instant ext

【在 f****y 的大作中提到】
: 答案看上去是对的,
: 多谢分析一下。

avatar
F*n
5
anonymous class's constructor is implicit declared from the class it extends,
and has
the exact signature of its super class. For example, if we have a class ClassA
with a constructor ClassA(x,y), we can have anonymous class like
ClassA classA = new ClassA(x,y) {
...method overriden...
};
As to C, how can an anonymous class that is a DIRECT subclass of Object
implements anything?

still

【在 n*****k 的大作中提到】
:
: Should be AC, B is apparent wrong, how can an anonymous class has a
: constructor, it simply can not have any constructors cause any constructor
: definition need a name. So an anonymous inner class simply uses the
: constructors of it's superclass. All the auguments passed in is going to
: superclass. So if inner class implements an interface, it can not take any
: arguments.
: A. is the main reason why you may think use the inner class, lazy!!! hehe.
: C. Is right, bacause any inner class is an instant ext

avatar
F*n
6
Sorry, C is right if we have an interface extends multiple interfaces.

extends,
ClassA
direct
still

【在 F****n 的大作中提到】
: anonymous class's constructor is implicit declared from the class it extends,
: and has
: the exact signature of its super class. For example, if we have a class ClassA
: with a constructor ClassA(x,y), we can have anonymous class like
: ClassA classA = new ClassA(x,y) {
: ...method overriden...
: };
: As to C, how can an anonymous class that is a DIRECT subclass of Object
: implements anything?
:

avatar
f*y
7
Thanks for discussion.
So can I make the conclusion?
The answer is AC.
A. obviously
B. the description is not suitable, because inner class has no constructor a
lthough can use the constructor of super, even with parameters.
C. can implements from one interface which extends multi interfaces.
D. E If the inner class extends one class which don't implements any interfa
ce, it has no way to implements any interface.

【在 F****n 的大作中提到】
: Sorry, C is right if we have an interface extends multiple interfaces.
:
: extends,
: ClassA
: direct
: still

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。