6. Control statements nested in loops Flashcards
1
Q
What is printed by the following code?
int x = 10;
int y = 20;
System.out.println(x + y > 30 ? x : y);
A
20.
2
Q
What is the effect of the following code?
System.out.println();
System.out.println();
System.out.println();
A
ss
3
Q
What do you think is the effect of the following code?
System.out.print(“”);
A
ss
4
Q
What limit is there on the nesting of statements within other statements?
A
There is no limit.
5
Q
What is wrong with the following code? int x = ... int y = ... if (x > y) { int large = x; int small = y; } else { int large = y; int small = x; } System.out.println(large + " is greater than " + small);
A
ss