当前位置: 技术问答>java相关
a problem about anonymous inner!!
来源: 互联网 发布时间:2015-02-24
本文导语: 15. Which of the following statements are true? A) An anonymous class cannot have any constructors B) An anonymous class can only be created within the body of a method C) An anonymous class can only access static fields of the enclosing cl...
15. Which of the following statements are true?
A) An anonymous class cannot have any constructors
B) An anonymous class can only be created within the body of a method
C) An anonymous class can only access static fields of the enclosing class
D) An anonymous class instantiated and declared in the same place.
C)为什么不对?能否举个例子?
A) An anonymous class cannot have any constructors
B) An anonymous class can only be created within the body of a method
C) An anonymous class can only access static fields of the enclosing class
D) An anonymous class instantiated and declared in the same place.
C)为什么不对?能否举个例子?
|
give me fen!
|
应该还可以访问final
|
f.addMouseMotionListener ( new MouseMotionAdapter() {
public void mouseDragged (MouseEvent e) {
String s = "Mouse dragging: X = " + e.getX() + " Y = " + e.getY();
tf.setText (s);
}
} );
注意tf,它可不是static
public void mouseDragged (MouseEvent e) {
String s = "Mouse dragging: X = " + e.getX() + " Y = " + e.getY();
tf.setText (s);
}
} );
注意tf,它可不是static
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。