title: Java stop reading after empty line
body: <p>I'm doing an school exercise and I can't figure how to do one thing.
  For what I've read, Scanner is not the best way but since the teacher only uses Scanner this must be done using Scanner.</p>
  
  <p>This is the problem.
  The user will input text to an array. This array can go up to 10 lines and the user inputs ends with an empty line.</p>
  
  <p>I've done this:</p>
  
  <pre><code> String[] text = new String[11]
   Scanner sc = new Scanner(System.in);
   int i = 0;
   System.out.println("Please insert text:");
   while (!sc.nextLine().equals("")){
          text[i] = sc.nextLine();
          i++;        
      }
  </code></pre>
  
  <p>But this is not working properly and I can't figure it out.
  Ideally, if the user enters:</p>
  
  <pre><code>This is line one
  This is line two
  </code></pre>
  
  <p>and now press enter, wen printing the array it should give:</p>
  
  <pre><code>[This is line one, This is line two, null,null,null,null,null,null,null,null,null]
  </code></pre>
  
  <p>Can you help me?</p>