Sail E0 Webinar
Question
What all gets printed when the following program is compiled and run?public class Test{ public static void main(String args[]){ int i=0, j=2; do{ i=++i; j--; }while(j>0); System.out.println(i); }}
Options:
A .  0
B .  2
C .  1
D .  None of these
E .  The program does not compile because of statement "i=++i;"
Answer: Option B

Submit Your Solution Below and Earn Points !
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers