标题: 谁能告诉我哪里错了!! [打印本页] 作者: xcy458778612 时间: 2015-8-2 07:14 标题: 谁能告诉我哪里错了!! import java.util.Scanner;
class DianMing
{
public static void DianMing(String[] name)
{
int a = 1;
do
{
int index =(int) (Math.random()*5);
System.out.println(name[index]);
Scanner sc = new Scanner(System.in);
System.out.println("是否继续点名? 1:继续;任意键:结束");
a = sc.nextInt();
}
while (a==1);
}
}
class DianMingTest
{
public static void main(String[] args)
{
String[] name = new String[5]{"张三","李四","王二","刘七","郑八"};
DianMing d = new DianMing();
d.DianMing(name);