public class Test {
public static void main(String[] args) {
int num1 = Integer.parseInt(args[0]);
Test object1 = new Test();
System.out.println(object1.calc(num1));
}
boolean calc(int c) {
if ( c >= 10 ) {
return true;
//else節がないため、コンパイラがすべての条件を満たす場合で //return文を記述していないと判断し、エラーが発生します。
} else if ( c < 10 ) {
return false;
}
}
}
|