阴影变量暂时不可用,因为已经在更直接的范围内声明了具有相同名称的变量。
public class Main { static int x; /* *来 自 n o w j a v a . c o m - 时代Java */ public static void main(String[] args) { x = 5; System.out.println("x = " + x); int x; System.out.println("x = " + x); x = 10; System.out.println("x = " + x); System.out.println("ShadowApp.x = " + Main.x); } }