问题描述
public class Main {
public static void main(String[] args) {
int x = 1;
if (x < 10)
if (x == 0)
System.out.println("Zero");
else if (x == 1)
System.out.println("One");
else
System.out.println("Other but smaller than 10");
else
System.out.println("Greater than 10");
}
}
我刚刚尝试过,它的工作原理与用花括号包围内部条件完全一样。
我知道可以在不使用花括号的情况下执行一行语句,但是为什么在这种情况下它可以工作?
谢谢,如果这是一个明显的问题,我感到抱歉。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)