import java.util.Scanner;
public class Student {
public static void main(String[] args)
{
int i,j;
Scanner input = new Scanner(System.in);
System.out.print("please enter the number of students:");
int number = input.nextInt();
String name[] = new String[number];//學生姓名數組
System.out.print("please enter their name:");
for(i=0;i<number;i++){
name[i] = input.nextLine();
}
for(j=0;j<number;j++){
System.out.println("as follows:"+name[j]);
}
}
}
運行後,輸入數字2,但輸入一次名字後程序就輸出結果了,為啥
http://blog.sina.com.cn/s/blog_6aa93fde01016vqr.html