Scanner
读取数据时:
输入例子:
2 helloo wooooooow
Scanner in = new Scanner(System.in);
int num = in.nextInt();
//消耗掉换行符
in.nextLine();
//需要判断是否还有下一行
while(in.hasNext(){
String str = in.nextLine();
}
读取数据时:
输入例子:
2 helloo wooooooow
Scanner in = new Scanner(System.in);
int num = in.nextInt();
//消耗掉换行符
in.nextLine();
//需要判断是否还有下一行
while(in.hasNext(){
String str = in.nextLine();
}