Ramdom类报错,不知道问题出在哪里?
package my_first_java;import java.util.Random;
/*****
* 洗牌算法
* @author xiang
*
*/
public class MyFirstJava {
public static void main(String[] args) {
String [] cards = {"黑桃A","红桃2","梅花7","梅花7","方块10","黑桃9"};
Ramdom r = new Random();
for(int i=cards.length-1; i>=1; i--){
int j = r.nextInt(i);//j=[0,i)
String t = cards[i];
cards[i] = cards[j];
cards[j] = t;
}
System.out.println("My first Java program!");// TODO Auto-generated method stub
System.out.print(cards);
}
}
编译报错:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Ramdom cannot be resolved to a type
at my_first_java.MyFirstJava.main(MyFirstJava.java:12)