title: Is the Java compiler is designed to work like this or is it a limitation?
body: <p>Say I have below lines any in a Java class,</p>
  
  <pre><code>System.out.println("start");
  if(true)//The compiler will give compile time error if I uncomment this. 
      throw new RuntimeException();
  System.out.println("end");
  </code></pre>
  
  <p>The unreachable code error message will appear if the <code>if(true)</code> is commented. Why Don't the compiler know that the line under <code>if(true)</code> will always be executed?</p>
  
  <p><strong>Is the Java compiler is designed to work like this or is it a limitation?</strong></p>