Menu
×
×
正确
// Create a checkAge() method with an integer variable called age
static void @(8)(@(3) @(3)) {
// If age is less than 18, print "Access denied"
@(2) (@(3) @(1) @(2)) {
System.out.println("Access denied");
// If age is greater than, or equal to, 18, print "Access granted"
} @(4) {
System.out.println("Access granted");
}
}
public static void main(String[] args) {
// Call the checkAge method and pass along an age of 20
@(8)(@(2));
}
// Create a checkAge() method with an integer variable called age
static void checkAge(int age) {
// If age is less than 18, print "Access denied"
if (age < 18) {
System.out.println("Access denied");
// If age is greater than, or equal to, 18, print "Access granted"
} else {
System.out.println("Access granted");
}
}
public static void main(String[] args) {
// Call the checkAge method and pass along an age of 20
checkAge(20);
}
不正确
点击 此处 重试 正确
下一题 ❯// Create a checkAge() method with an integer variable called age static voidw3exercise_input_no_0(w3exercise_input_no_1w3exercise_input_no_2) { // If age is less than 18, print "Access denied"w3exercise_input_no_3(w3exercise_input_no_4w3exercise_input_no_5w3exercise_input_no_6) { System.out.println("Access denied"); // If age is greater than, or equal to, 18, print "Access granted" }w3exercise_input_no_7{ System.out.println("Access granted"); } } public static void main(String[] args) { // Call the checkAge method and pass along an age of 20w3exercise_input_no_8(w3exercise_input_no_9); } |