阅读下面的代码,输出结果是
publicstaticvoidmain(String[]args){
Randomrandom1=newRandom(10);
Randomrandom2=newRandom(10);
for(inti=0;i<5;i++){
System.out.print(random1.nextInt(5));
}
System.out.println();
for(inti=0;i<5;i++){
System.out.print(random2.nextInt(5));
}
}
publicstaticvoidmain(String[]args){
Randomrandom1=newRandom(10);
Randomrandom2=newRandom(10);
for(inti=0;i<5;i++){
System.out.print(random1.nextInt(5));
}
System.out.println();
for(inti=0;i<5;i++){
System.out.print(random2.nextInt(5));
}
}
举一反三
- 阅读下面的代码,输出结果是( ) public static void main(String[] args) { Random random1 = new Random(10); Random random2 = new Random(10); for(int i=0;i<5;i++){ System.out.print(random1.nextInt(5)); } for(int i=0;i<5;i++){ System.out.print(random2.nextInt(5)); } }
- 阅读下面的代码 public static void main(String[] args) { Random random1 = new Random(10); Random random2 = new Random(10); for(int i=0;i<5;i++){ System.out.print(random1.nextInt(5)); } System.out.println(); for(int i=0;i<5;i++){ System.out.print(random2.nextInt(5)); } } 下列选项中,程序的输出结果是
- 阅读下面的代码,输出结果是() public static void main(String[] args) { Random random1 = new Random(10); Random random2 = new Random(10); for(int i=0;i<5;i++){ System.out.print(random1.nextInt(5)); } for(int i=0;i<5;i++){ System.out.print(random2.nextInt(5)); } } A: 3.030130301E9 B: 5.04813268E9 C: 3.268023579E9 D: 1111111111
- 以下代码的输出结果是_________。publicstaticvoidmain(String[]args){for(inti=1;i<;=10;i++){if(i%2==0||i%5==0){continue;}System.out.print(i+"\t");}} A: 1 B: 134 C: 13579 D: 1379
- 下列选项中,循环会无限执行的是______。 A: int i = 1 ; while ( i < 10) System .out .print( “ ” + i) ; B: for( int i = 1 ; i < 10 ;i ++) System .out .print( “ ” + i); C: for( int i = 10 ; i > 0 ;i --) System .out .print( “ ” + i); D: int i = 1 ; while (true) { System .out .print( “ ” + i); i ++ ; if ( i > 5) break ;