初級 › if文の括弧と比較演算子 › パターン1
if文の括弧と比較演算子
= と == の取り違え、&& と and の混同など、条件式まわりの定番ミスを扱います。
1 public class Main { 2 public static void main(String[] args) { 3 int n = 5; 4 if _n > 3) { ^ 5 System.out.println("big"); 6 } 7 } 8 }
Main.java:4: error: '(' expected
空欄を埋めてビルドを通す
ifの条件は必ず丸括弧で囲みます。Pythonのようにコロンで書くことはできません。
次の問題