一道题,给100分

wzy888 2003-09-16 03:45:55
Which of the following statements are true?(Choose one or more)
A. Given that Inner is a non-static class declared inside a public class
Outer, and appropriate constructor forms are defined, an instance
of Inner may be constructed like this:
new Outer().new Inner()
B. If an anonymous inner class inside the class Outer is defined to
implement the interface ActionListener, it may be constructed
like this :
new Outer().new ActionListener()
C. Given that Inner is a non-static class declared inside a public class
Outer and appropriate constructor forms are defined, an instance
of Inner may be constructed in a static method like this:
new Inner()
D. An anonymous class instance that implements the interface
MyInterface may be constructed and returned from a method
like this:
return new MyInterface(int x){
int x;
public MyInterface(int x){
this.x = x;
}
};
...全文
74 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
panpan221 2004-03-16
  • 打赏
  • 举报
回复
学习一下,不过我决的答案是:A
Computer_lover 2004-01-07
  • 打赏
  • 举报
回复
同意楼上,AD正确
Raolph 2004-01-06
  • 打赏
  • 举报
回复
I think A & D are right.
jinsixiong 2004-01-06
  • 打赏
  • 举报
回复
不懂
101monster 2004-01-06
  • 打赏
  • 举报
回复
呵呵,A,Ft!
CharmingChen 2004-01-06
  • 打赏
  • 举报
回复
嗯,A正确
panpan221 2004-01-02
  • 打赏
  • 举报
回复
A正确
ppgoodboy 2003-09-26
  • 打赏
  • 举报
回复
正解 A(因为。。。所以。。。)实践出真知
admiralsf 2003-09-25
  • 打赏
  • 举报
回复
A怎么能对呢飞静态内部蕾要先定义外部类的实例来实例化用Outer.Inner in=out.new Inner();
B匿名类只有在定义时生成的实例,不能再其他地方再实例化。而且两个new更不对。
C静态方法中不能直接使用非静态成员(它没this)。
D我认为是对的,自己上级试验一下,两个x一个是域,一个是局部变量。
stamp80 2003-09-20
  • 打赏
  • 举报
回复
肯定是A。D的new MyInterface(int x)不会返回值,不对。
moke33 2003-09-20
  • 打赏
  • 举报
回复
偶也认为应该是A
njucon 2003-09-19
  • 打赏
  • 举报
回复
A
yshen 2003-09-19
  • 打赏
  • 举报
回复
A 一定是正确的
BC 是错误的
D 不太清楚,但我上机调试的结果是编译错误。
xciennini 2003-09-19
  • 打赏
  • 举报
回复
a,d中不是2个X冲突了,和这个没关系,具体说不上来,回去查查看!
csdnxw 2003-09-19
  • 打赏
  • 举报
回复
A
学习中

D中俩x是不是冲突了?
altonpeng 2003-09-19
  • 打赏
  • 举报
回复
a
chenxb1980 2003-09-18
  • 打赏
  • 举报
回复
a
veijerd 2003-09-18
  • 打赏
  • 举报
回复
俺也觉得是A
asdmonster 2003-09-18
  • 打赏
  • 举报
回复
A
MeMeFang 2003-09-18
  • 打赏
  • 举报
回复
功力不夠,看不懂.
加载更多回复(1)

51,407

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧