关于Scanner比较奇怪的问题
import java.util.Scanner;public class Testerone
{
public static void main(String[] args)
{
Scanner in =new Scanner(System.in);
System.out.println("Input AccountID: ");
int anAccountID = Integer.parseInt(in.next());
System.out.print( "Input Address: ");
String street = in.nextLine();
System.out.println( "Input Job: ");
String Job = in.nextLine();
System.out.println(anAccountID);
System.out.println(street);
System.out.println(Job);
}
}
ID是int, Address是中间有空格的字符串,Job是无空格字符串。
实在是想不出来这代码错在哪里?
请大家帮忙看下!