Consider the following program:
class Char //1
{ //2
public static void main(
String[] args) //3
{//4
while(false)//5
{ //6
System.out.println("Hello");//7
} //8
while(false) //9
{ //10
}
do;
while(false);
do
{
;
}
while(false);
}
}
When I tried to compile it, I got:
Char.java:6: unreachable statement
{
^
Char.java:10: unreachable statement
{
^
I can't understand why lines 6, 10 are unreachable. Plz explain.
Isn't the while loop altogether skipped considering that the while condition evaluates to false?