title: geting a multiline text with scanner class in java
body: <p>In a part of my university project I have to get a text with some lines then saving it in a string or a string array.My problem is that in scanner class using methods gets only one line of the input. So I cannot get the other lines.please help me.</p>
  
  <pre><code>public class Main {
  public static void main(String[] args) {
      java.util.Scanner a = new java.util.Scanner(System.in);
      String b = "";
      while (a.hasNextLine()) {
          b += a.nextLine();
      }
  }
  </code></pre>
  
  <p>}</p>