Reachability of Statements

In decision making statements, must write in such a way so that at least for one exception condition java program must be reachable. There must be at least one exception path of execution that will “reach” to statement.

For Example
This code will not compile because ++count is unreachable.

class TestExample {
	public static void main(String[] args) {
	int count = 0;
	//This won't compile because reachability rule not with while
	//statments inside block for false
	while (false) {
		++count;
		}
	}
}

The exception to the reachability rule apply with the if statement.
The following code does compile:

class TestExample {
	public static void main(String[] args) {
	// This compiles fine.
	int count = 0;
	if (false)
	{
	++count;
	}
}
}

Note: If statement is special so that can be used for conditional compilation. In above code would compile file , but the if (false) { ++Count; } code would not appear in the class file.