SCJP Module-5 Question-9

The Program given below will test your understanding of loop and its flow in Java program. This example is also very useful for preparation of SCJP exam.

 
 

Share on Google+Share on Google+

SCJP Module-5 Question-9

Ads

The Program given below will test your understanding of loop and its flow in Java program. This example is also very useful for preparation of SCJP exam.

Given a sample code:

public class Test {
public static void main(String args[]) {
int i = 9;
while (i++ <= 12) {
i++;
}
System.out.print(i);
}
}

What will be the result of above code ?

(1) 10
(2) 14
(3) 13
(4) 11

Answer:

(2)

Advertisements

Posted on: July 12, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles