Number Comparison
題目說明
請修正以下程式碼,該程式比較兩個整數並輸出比較結果。程式有部分內容錯誤或缺失,請修正使其正確執行。
public class BooleanComparison {
public static void main(String[] args) {
int number1 = 10;
int number2 = 5;
if (number1 > number2) {
System.out.println(number1 + " " + number2 + );
} else {
System.out.println("Comparison failed.");
}
}
}
如果第一個數小於第二個數,輸出 "X is smaller than Y."。
否則,輸出 "X is not smaller than Y."。
輸入
本題無需輸入,數字已在程式內設定。
輸出
根據比較結果輸出一行字串。
範例輸出 #1
10 is not smaller than 5.
Comments