爲什麼輸出「休息」和「學習?」它不應該只是「學習」嗎?兩條if語句的輸出
boolean isSleeping = false;
boolean isStudying = true;
if (isSleeping)
System.out.println(" Sleeping ");
System.out.println(" Resting ");
if (isStudying)
System.out.println(" Studying ");
因爲'System.out.println(「Resting」);'不在第一個if語句中。 – immibis
大括號定義塊的範圍.. – TheLostMind
Python轉換? – usr2564301