import java.util.*;
public class GSX52 {
public static void main(String[] args){
Random rand = new Random(47);
float f[] = new float[10];
for(int i=0;i<10;i++){
f[i]= rand.nextFloat();
}
for (float x:f)
System.out.println(x);
}
}
运行结果配图
import java.util.*;
public class GSX52 {
public static void main(String[] args){
Random rand = new Random(2);
//float f[] = new float[10];
int f[] =new int[10];
for(int i=0;i<10;i++){
f[i]= rand.nextInt();
System.out.println(f[i]);
}
for (int x:f)
System.out.println(x);
}
}
运行结果配图
import java.util.*;
public class GSX52 {
public static void main(String[] args){
for(char c : "An African Swallow".toCharArray())
System.out.println(c+" ");
}
}
运行结果配图