public class Text3 {
public static void main(String[] args) {
String[] arr ={"张三","王五","李四","周六","小2"};
while(true) {
int x = (int)(Math.random()*arr.length);
String name = arr[x];
Scanner sc = new Scanner(System.in);
System.out.println("是否继续?0代表停止,否则继续");
String num =sc.nextLine();
if (num.equals("0")) {
break;
}else {
System.out.println(name);
} |
|