提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
嵌套块和可变范围
public class Main { /** * 时代Java公众号 - nowjava.com 提 供 **/ public static void main(String[] arg) { boolean x = false; if (x = true) System.out.println("x is true"); else System.out.println("x is false"); int i = 3; int j = 4; System.out.println("i=" + i + " j=" + j); { // Cannot redefine a variable i here int ii = 5; j++; i--; } System.out.println(