Output of following question and why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Output of following question and why?

int a=5 , b=10; int(a>5) if(b>5) { System.out.println(b); } else System.out.println(a);

26th May 2019, 5:58 AM
light
light - avatar
3 Answers
+ 1
I got it. Thanks.
26th May 2019, 6:38 AM
light
light - avatar
0
But in Java if condition block starts with " { " so how can one be certain that the 1st if block contains other code.
26th May 2019, 6:30 AM
light
light - avatar
0
compare with this int a=5 , b=10; if (a>5) { if(b>5) { //nested if block System.out.println(b); } } else System.out.println(a); // output 5
26th May 2019, 7:23 AM
zemiak