Originally posted by S Thiyanesh:
If there is any statement after while(true) its unreachable.
Hi Thiyanesh..
i just checked it... this code also runs fine because it's while(true) so the statement just after while is always reachable but if it's while(false) then it will give compiler error of saying that the statement below while is unreachable.
code: while(true)
{
System.out.println("Compiles fine");
}
code: while(false)
{
System.out.println("Unreachable statement");
//since at compiletime the statements below while are unreachable
}
Regards
swapnil