title: BufferedReader readLine() not working in a while loop
body: <p>When I call readLine() inside the while loop block, somehow, even when I pressed enter, the input won't finish. Looks like, it creates a new line but still waiting for the line input to be terminated.</p>
  <pre><code>public static void main(String[] args) throws IOException {
    // TODO Auto-generated method stub
    InputStreamReader isr = new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(isr);
  
    String line = &quot;&quot;;
    while(!line.equals(&quot;End&quot;)){
      line = br.readLine();
      System.out.println(&quot;String from keyboard not working : &quot;+line+&quot;\n&quot;);
    }
    
    while((line = br.readLine())!=null) {
      System.out.println(&quot;String from keyboard in while loop : &quot;+line+&quot;\n&quot;);
    }
  }
  </code></pre>
  <p>When I put readline() on top of while's condition section, it works fine.
  I want to know why the former while doesn't work.</p>