编写一个类Example 2)在main方法下定义变量x,并在每一层大括号内都使用一次x,观察x的作用域 3)在第一层括号内定义变量y,并在第二层括号内使用y,观察y的作用域 4)在第二层括号内定义z,并在第一层括号内使用z,观察z的作用域
public class Example{
public static void main(String []args){
int x=1;
int y=2;
if(true){
int z=3;
x=x+1;
y=y+1;
}
z++;
}
}