About Question com.enthuware.ets.scjp.v6.2.651 :
Posted: Thu Dec 11, 2014 9:51 am
Dears, explain please the next task,
class TestClass
{
public static void main(String args[])
{
boolean b = false;
int i = 1;
do
{
i++ ;
} while (b = !b);
System.out.println( i );
}
}
How 'i' gets 3 ?? Yet, (b = !b ) == true, then it should be infinite loop ...
Thanks
Dmitry
class TestClass
{
public static void main(String args[])
{
boolean b = false;
int i = 1;
do
{
i++ ;
} while (b = !b);
System.out.println( i );
}
}
How 'i' gets 3 ?? Yet, (b = !b ) == true, then it should be infinite loop ...
Thanks
Dmitry