是呀 代码没上全
class Outer
{
int x=1; void show()
{
final int y=2;
//public class Inner不能被修饰符修饰
class Inner
{
void func()
{
//System.out.println(Outer.this.x);
System.out.println(y);
}
}
new Inner().func();
}
}class InnerDemo
{
public static void main(String[] args)
{
new Outer().show();
}
}
不加final 我觉得编译不会通过 可是都能出结果 哪有问题呢
class Outer
{
int x=1; void show()
{
final int y=2;
//public class Inner不能被修饰符修饰
class Inner
{
void func()
{
//System.out.println(Outer.this.x);
System.out.println(y);
}
}
new Inner().func();
}
}class InnerDemo
{
public static void main(String[] args)
{
new Outer().show();
}
}
不加final 我觉得编译不会通过 可是都能出结果 哪有问题呢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货