由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - 问题征解
相关主题
java的一个问题请教一个动态cast的问题
anonymous innerclass reflection questioncan applet implements runnable?
一道java题问一个特别土的问题
who can help me with this dummy Question??interface和implementation class
问个基本问题Re: How to use abstract class?
有熟悉Java Reflection的吗2 Questions about Constructor
请问一个语法问题how to copy an Object?
Java的method不都是virtual的么?private就不同了?继续问土问题
相关话题的讨论汇总
话题: class话题: inner话题: anonymous话题: classa
进入Java版参与讨论
1 (共1页)
f****y
发帖数: 70
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
F****n
发帖数: 3271
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

f****y
发帖数: 70
3
答案看上去是对的,
多谢分析一下。

【在 F****n 的大作中提到】
: AB
n*****k
发帖数: 123
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 的大作中提到】
: 答案看上去是对的,
: 多谢分析一下。

F****n
发帖数: 3271
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

F****n
发帖数: 3271
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?
:

f****y
发帖数: 70
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

1 (共1页)
进入Java版参与讨论
相关主题
继续问土问题问个基本问题
copy constructor都什么时候be called啊有熟悉Java Reflection的吗
basic java question请问一个语法问题
Weblogic 8.1又一个问题---应该是有关JDBC的Java的method不都是virtual的么?private就不同了?
java的一个问题请教一个动态cast的问题
anonymous innerclass reflection questioncan applet implements runnable?
一道java题问一个特别土的问题
who can help me with this dummy Question??interface和implementation class
相关话题的讨论汇总
话题: class话题: inner话题: anonymous话题: classa