public class LianXil {
static int h=1;
private int i=2;
public void myVoid()
{
final int j=3;
int k=4;
class Nei
{
public void myNeiVoid()
{
System.out.println(h);
System.out.println(i);
System.out.println(j);
//System.out.println(k);
}
}
Nei n=new Nei();
n.myNeiVoid();
}
public static void main(String args[])
{
LianXil lx=new LianXil();
lx.myVoid();
}
}
h、i、j 都能正常访问,但是 把第四个//System.out.println(k); 给释放,访问 K 就会发生变异异常,这是为什么? |