Java: read from console until getting a blank line
<p>I wrote this method, which is never ending. It isn't printing what I'm passing, why?</p>

<pre><code>import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

class Main {

   public void readFromConsole() {

          ArrayList&lt;String&gt; wholeInput= new ArrayList &lt;String&gt;();  

          InputStreamReader isr = new InputStreamReader(System.in);
          BufferedReader br = new BufferedReader(isr);

           try {
                String line = null;
                while (!(line = br.readLine()).equals(" ")){
                wholeInput.add(line);
           }

        }
        catch(IOException e){
            e.printStackTrace();
        }

       for (int i =0; i&lt;wholeInput.size();i++){
              System.out.println(wholeInput.get(i));
       }
    }
</code></pre>

<p>}</p>
