Activity 1.27.1.
isLessThan23(24)
isLessThan23(18)
isLessThan23(23)
public static boolean isLessThan23(int number) { if (!(number >= 23)) { return true; } else { return false; } }
- Correct!
public static boolean isLessThan23(int number) { return !(number >= 23); }
- Correcr!
public static boolean isLessThan23(int number) { if (number < 23) { return true; } else { return false; } }
- Correct!
public static boolean isLessThan23(int number) { return number < 23; }
- Correct!
Look at the first code block. Which of the following options have the same functionality as it (i.e., they produce the same output for the same inputs)? You can check the Hint for some input examples.
public static boolean isLessThan23(int number) {
if (number >= 23) {
return false;
} else {
return true;
}
}
Hint.
You can use the following test cases to compare the code blocks’ functionality.
Select all that apply.