由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - inner class 让认糊涂
相关主题
问一个java的面试题 (转载)请教一个有关 inner class 的问题
Why inner classes can access only local final variables?static final的问题
感觉inner class挺好用的java inner class - 初学者问
Jar questionaccess java parent class protected variable question
help on this scope question请教:怎么把synchronize的method改成用thread 但thread safe呢?
Re: help: how does the class Model$5.class come?jsf commandlink not working when bean in request scope
关于inner class的继承JavaBean variable name standard
[合集] java 得 inner class 有没有 static 有什么区别啊?how to solve the problem: the members change by each other .
相关话题的讨论汇总
话题: class话题: inner话题: 糊涂话题: scope话题: listeners
进入Java版参与讨论
1 (共1页)
W***o
发帖数: 6519
1
看了core java这本书里的inner class部分,觉得很糊涂啊,有没有大侠能指点一下,
理清一下思路。这个除了能access private field和variable,还能干啥?主要是干什
么用的?谢谢
p*****2
发帖数: 21240
2
你说的这两个好处就已经很方便了。
W***o
发帖数: 6519
3
谢谢二爷您嘞

【在 p*****2 的大作中提到】
: 你说的这两个好处就已经很方便了。
s******e
发帖数: 493
4
four types:
static inner class: really should not be called inner class, especially
public one. I hardly find it useful But I did see somebody uses it to
emphasize the domain relationship.
inner class: mostly be used for event listeners or for limiting publication
scope to the enclosing class. Occasionally it might escape from class scope.
method local inner class: never use it. you use it when you really want to
limit it's life scope. It is the preferred question for an interview: about
what kind of variables you an access from it.
anonymous class: can be at class, object or method level. used a lot for
event listeners especially in Swing.
z*******3
发帖数: 13709
5
ui常见,其他时候你完全可以避开不用
1 (共1页)
进入Java版参与讨论
相关主题
how to solve the problem: the members change by each other .help on this scope question
问一简单的问题 关于importRe: help: how does the class Model$5.class come?
multiple classes in one file:revisted关于inner class的继承
Object scope question[合集] java 得 inner class 有没有 static 有什么区别啊?
问一个java的面试题 (转载)请教一个有关 inner class 的问题
Why inner classes can access only local final variables?static final的问题
感觉inner class挺好用的java inner class - 初学者问
Jar questionaccess java parent class protected variable question
相关话题的讨论汇总
话题: class话题: inner话题: 糊涂话题: scope话题: listeners