package number;
import java.util.Scanner;
public class chapter03 {
public static void main(String[] args) {
Scanner s_num = new Scanner(System.in);
System.out.println("请输入人数:");
int sum = s_num.nextInt();
String[] stu_array = new String[sum];
//循环输入姓名
Scanner s_name = new Scanner(System.in);
for(int i = 0;i < stu_array.length;i++){
System.out.println("请输入第"+(i+1)+"名同学:");
stu_array[i] = s_name.next();
}
System.out.println("人员名单初始化已完成,是否开始抽取,(1/2)抽取/取消");
Scanner s_int = new Scanner(System.in);
if(1 == s_int.nextInt()){
//产生随机数
int num = (int)(Math.random()*(stu_array.length));
System.out.println("抽取的同学是:"+ stu_array[num]);
}else{
System.out.println("取消成功");
}
}
}