为什么Random random = new Random();这个会报错?求解。

最是那轻风吹拂我的脸 2011-04-10 03:29:21
package quickHit;
import java.lang.Math;
public class Game {
private Player player;
public static int[] randoms(){
Random random = new Random();
int temp1,temp2;
int send[] = {0,1,2,3,4,5};
int strLength= send.length;
int returnValue[] = new int[5];
for(int i=0;i<6;i++)
{
temp1 = Math.abs(random.nextInt())%strLength;
returnValue[i] = send[temp1];
temp2 = send[temp1];
send[temp1] = send[strLength-1];
send[strLength-1] = temp2;
strLength--;
}
return returnValue;
}
}
...全文
1009 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
星空时砂 2011-04-11
  • 打赏
  • 举报
回复
import java.util.*;
铁匠梁老师 2011-04-10
  • 打赏
  • 举报
回复
路过,问题已解决
peterandy110 2011-04-10
  • 打赏
  • 举报
回复
没导入包啊
wklken 2011-04-10
  • 打赏
  • 举报
回复
汗~~
用eclipse时候,一发现这种,ctrl+shift+o
自动导入缺失的
Dead_Cicle 2011-04-10
  • 打赏
  • 举报
回复
一想就是导包的问题啊。
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 magong 的回复:]
import java.util.Random;
[/Quote]

谢谢你 I love you
magong 2011-04-10
  • 打赏
  • 举报
回复
import java.util.Random;

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧