Java 语法
Java 变量
Java 数据类型
Java 运算符
Java 字符串
Java 数学
Java 布尔值
Java 如果...否则
Java 开关
Java 循环
Java 数组
Java 方法
Java 类/对象
Java 异常

Menu
×
×
正确

练习:

根据评论在下面的代码中插入缺失的部分:

// 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 void ( ) {

  // If age is less than 18, print "Access denied"
   (  ) {
    System.out.println("Access denied"); 

  // If age is greater than, or equal to, 18, print "Access granted"
  }  {
    System.out.println("Access granted"); 
  }

} 

public static void main(String[] args) { 
  // Call the checkAge method and pass along an age of 20
  ();
}







×

重置分数?