public class Temp
{
public static void main(
String[] args)
{
int i = 0;
for ( ; i<10; i++) ; // (1)
System.out.println("1= "+i);
for (i=0; ; i++) break; // (2)
System.out.println("2= "+i);
for (i=0; i<10; ) i++; // (3)
System.out.println("3= "+i);
for ( ; ; ) ; // (4)
System.out.println("4= ");
}
}
When I compile javac Temp.java, I get an error For the fourth System.out.println as "statement unreachable". Has it been at runtime I can consider that the fourth for loop is an infinite so the System.out.println is unreachable. This is compile time error.