hi
why the compiler thrown unreachable error
how the true or false in while loop influence the unreachable statement at (1) and (2)
class
Test {
public static void main (
String args[])
{
int i=1;
do
while(false) //always true
System.out.println( "Ok" ) ;//unreachable statement (1)
while( i < 1 );
System.out.println("hai");
}
}
class Test
{
public static void main (String args[])
{
int i=1;
do
while(true) // true
System.out.println( "Ok" ) ;
while( i < 1 );
System.out.println("hai");//unreachable statement (2)
}
}