BufferReader readline() method hangs for system.in
<p>I am executing a simple java application in eclipse.</p>

<p>Sample code:</p>

<pre><code> BufferedReader input = new BufferedReader( new InputStreamReader(System.in));
    String line;
    while((line = input.readLine()) != null &amp;&amp; line.length() != 0) 
    {
    System.out.println("------"+line);
    }
</code></pre>

<p>In the above code the readline() method hangs when reading the last line of my input.
I have gone through some threads and understood that it waits for the end of line.
I don't want to give any '\n' or '\r' at the end of my input in the console. 
so how to handle this in the code.</p>
