Question: Assuming that the user provides 9 9 as input, what is printed by the following code snippet? int a; int b; Scanner in = new

Assuming that the user provides 99 as input, what is printed by the following code snippet?
int a; int b;
Scanner in = new Scanner(System.in);
System.out.print("Please enter a number: ");
b = in.nextInt();
if (b >300){
a = b;
}
else {
a =0;
}
a = a +2;
System.out.println("a: "+ a);

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!