- What value would be printed for the following code?
int val = 12 - 4 / 2;
System.out.println(val);
- Read the following loop. How many question marks will it print?
for ( int i = 10; i > 5; i-- )
{
System.out.println("?");
}
- Read the following loop. How many question marks will it print?
Tip: Trace or "mind-execute" the code, keeping track of the values of
i
and j
as you go.
for ( int i = 0; i < 5; i++ )
{
for ( int j = i; j < 3; j++ )
{
System.out.println("?");
}
}