求大佬解答!!!
public class Test1 {
private static int i = 0;
private static int j = 0;
public static void main(String[] args) {
int i = 2;
int k = 3;
{
int j = 3;
System.out.println("i + j is " + (i + j));
}
k=i+j;
System.out.println("k is "+k);
System.out.println("j is "+j);
}
}
为什么 j 进入大括号后被定义并赋值为3后,出来又变为了0
而 i 同属为私有型类变量重新在main方法里赋值了没进大括号,值就变了