0

How the output of this code is 'i=0' ?

int i=0; while(i>0) { if(i==3) { break; } ++i; } System.out.println("i="+i);

6th Apr 2018, 4:59 AM
Amarjeet Sahoo
Amarjeet Sahoo - avatar
1 Answer
+ 8
0 is assigned to i, 0 > 0 is false, so everything inside the while block is skipped and the output is i=0
6th Apr 2018, 5:04 AM
Tashi N
Tashi N - avatar