title: Unreachable code while loop
body: <p>When I'm compiling this code </p>
  
  <pre><code>public static void main(String [] args) {
  
          int x = 0;        
  
          while(false)
          {                        
              System.out.println(hello);
          }
      }
  </code></pre>
  
  <p>it is showing compile time error unreachable code.</p>
  
  <p>But when I modified this code to</p>
  
  <pre><code>public static void main(String [] args) {
  
          int x = 0;        
          boolean result = false;
          while(result)
          {                        
              x=4;
          }
      }
  </code></pre>
  
  <p>it's working fine.</p>
  
  <p>Can somebody tell me the reason behind this behavior.</p>