1)it will print odd and even numbers from 0 to 9 corectly(0 even and 1 odd) 2)it will print odd and even numbers from 0 to 9 incoreectly(0 odd and 1 even. 3)compiler error at line 9 4)compiler error at line 10 5)it will result in infinite loop.
Let me first tell you the correct answer is choice 1 and secondly output is Even 0 odd 1 Even 2 odd 3 Even 4 odd 5 Even 6 odd 7 Even 8 odd 9
The reason you got the output that you have typed in your message is because you ran your program using java Asserttest2 which has Assertion set to DISABLED by default. Hence for assertions to work run your program using command java -ea Asserttest2 which will enable the assertions and you will get the expected output.
Joined: Nov 14, 2006
Hi, i am getting the same output even if assertions are enabled