import java.util.Scanner;
System.out.println("--------随机点名--------");
int n;
System.out.println("请输入学生人数:");
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
String[] students =new String[n];
for(int i=0;i<students.length;i++) {
System.out.println("请输入第"+(i+1)+"个学生姓名:");
students[i]=sc.next();
}
for(int i=0;i<students.length;i++) {
System.out.println("第"+(i+1)+"个学生姓名:"+students[i]);
}
Random random=new Random();
int index=random.nextInt(students.length);
String name=students[index];
System.out.println("被点到名的学生为"+name);
}