我是 Java 初学者,我刚刚编写了一个程序来获取用户的姓名、电话号码和地址。问题是在读取电话号码后,程序不会继续读取地址,就像跳过它一样。这是我的代码:
public static void main(String [] arge){
Scanner sc = new Scanner(System.in);
System.out.println("Enter your name, phone number and address");
String name = sc.nextLine();
long phone = sc.nextLong();
String address = sc.nextLine();
System.out.println("\n *** Here is your info ***");
System.out.println("Name: "+name+"\nPhone number: "+phone+"\n Address: "+address);
}