Question:Which of the following code snippets will generate five random numbers between 0 and 200? 

A 
Random r = new Random(); 
for (int i = 0; i < 5; i++) {
 System.out.println(r.nextInt(0,200)); 
}
 

B 
Random r = new Random(200); 
for (int i = 0; i < 5; i++) { 
 System.out.println(r.nextInt()); 
}
 

C 
Random r = new Random(); 
for (int i = 0; i < 5; i++) { 
 System.out.println(r.nextInt(200)); 
}
 

D 
Random r = new Random(200); 
for (int i = 0; i < 5; i++) { 
System.out.println(r.nextInt(0)); 
}
 

+ Answer
+ Report
Total Preview: 714

Copyright © 2024. Powered by Intellect Software Ltd