Question: 17) What will the following code print? int n = 0; for (int a=0; a <5; a+=1) { for (int b=0; b

17) What will the following code print?

int n = 0;

for (int a=0; a<5; a+=1) {

for (int b=0; b

n += 1;

}

}

System.out.println(n);

18) Assuming age is an int variable with value 37, what does the code below print?

if (age < 21) {

System.out.println("kid");

} else if (age < 80) {

System.out.println("adult");

} else {

System.out.println("old timer");

}

19) Assuming x is an int with value 9 and y is an int with value 14, what does the code below print?

if (x < y) {

if (y < 10) {

System.out.print("one");

} else {

System.out.println("two");

}

}

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 Databases Questions!