package myfirstprogram;
import static java.lang.System.in;
import java.util.Scanner;
public class MyFirstProgram {
public static void main(String[] args) {
//get the users name
Scanner sc = new Scanner(System.in);
System.out.println("Please Enter Your Name");
String name;
name = sc.nextLine();
//get the users age
System.out.println("Please Enter Your Age ");
***int age = in.nextInt();***
//Print out information
System.out.println("Hello" + name + ", you are" + age + "years old.");
}
}
Java说无法找到“int age”的符号其他一切正常,但它不会运行:/
答案 0 :(得分:0)
//让用户年龄
System.out.println("Please Enter Your Age ");
***int age = in.nextInt();***
改为使用int age = sc.nextInt();