结帖率:66.67%
楼主发表于:2011-11-15 10:40:46
Java code
//DemoClass.java
public class DemoClass{
public static void main(String[] args){
DemoClass dc = new DemoClass();
dc.setI();
System.out.println(dc.i);
}
int i = 10;
void setI(){
final int m = 0; //
class D{
void sI(){
m = 20; //在内部类中访问局部变量m,为啥要m要位final型的呢?
}
}
new D().sI();
}
}
|