0
What is the output of following snippet and give reason for your answer?
i=10; j=10; if(a<100){ if(b>50) i++; } else ++j; system.out.println("i="+i); system.out.println("j="+j);
4 odpowiedzi
+ 10
Yeah.. Right @krishna. I've read the code only.
+ 7
@Kyle,@siddiq : Values of a and b are mentioned in the tags of this post.
a<100 is true
b>50 is true
So, i = 11 after increment.
Output is:
i=11
j=10
+ 1
I don't think this will work.
0
sir, it output will be i=21,j=20
as,a<100 is true
b>50 is true
and after adding i=+i ,it will be 20 and by increment it will be 21 and by adding j=+j ,
it will be 20