Question: How many output ( s ) appear on console when the given code segment is executed? import java.util.Random; public class Test { public static void

How many output(s) appear on console when the given code segment is executed?
import java.util.Random;
public class Test {
public static void main(String[] args){
Random rand = new Random();
int number = rand. nextInt();
if(number >1 & & number 10)
System.out.println(number);
else if(number >=10 & number 100)
System.out.println(number *10);
else if(number >=100 & number 1000)
System.out.println(number *100);
}
}
1
4
2
3
 How many output(s) appear on console when the given code segment

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!