Dear All,
Hey,
I have a small doubt about while loop. I have the following peice of code.
**********************
class while1
{
public static void main(
String args[])
{
while(false)// 1
{
System.out.println("IN WHILE"); // 2
}
System.out.println("OUT OF WHILE");// 3
}
}
**********************
I tried to compile it, but it says that :
D:\file>javac while1.java
while1.java:6: unreachable statement
{
^
1 error
If, the condition at 1 is false, then it says that the statement 2 is unreachable, otherwise, if the condition is true, then it says statement 3 is unreachable. Why is this happening??
Bye,
Tualha Khan