package random;
import java.util.Random;
public class testseed1000 {
public static void main(String[] args){
Random ran =new Random(System.currentTimeMillis());
for(int i=0;i<1000;i++){
System.out.println(ran.nextInt());
}
}
}
关于生成1000个随机整数使用关于时间的seed种子创建随机数然后将其放入循环循环1000次`得到一千个随机整数.
public class MethodOverload {标签:square,动脑,System,动手,Random,static,public,out From: https://www.cnblogs.com/guozi6/p/17723071.html
public static void main(String[] args) {
System.out.println("The square of integer 7 is " + square(7));
System.out.println("\nThe square of double 7.5 is " + square(7.5));
}
public static int square(int x) {
return x * x;
}
public static double square(double y) {
return y * y;
}
}