下面是想用random产生两个不同的数,打印出来。。为什么我写的类会产生相同的随机数??
以下是代码:
import java.util.Random;public class studentInfo { /**
 * @param args
 */
String _name;
String _age;
double _;
public void set_(){
_=new Random().nextDouble()*100;
}
public double get_(){
return this._;
}
public static void main(String[] args) {
studentInfo student=new studentInfo();
student.set_();
System.out.println(student.get_());
student.set_();
System.out.println(student.get_());
}}