title: Why can't I enter a string in Scanner(System.in), when calling nextLine()-method?
body: <p>How does this program actually work...?</p>
  
  <pre><code>import java.util.Scanner;
  
  class string
  {
      public static void main(String a[]){
          int a;
          String s;
          Scanner scan = new Scanner(System.in);
  
          System.out.println("enter a no");
          a = scan.nextInt();
          System.out.println("no is ="+a);
  
          System.out.println("enter a string");
          s = scan.nextLine();
          System.out.println("string is="+s);
      }
  }
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>enter the no
  1234
  no is 1234
  enter a string
  string is=         //why is it not allowing me to enter a string here?
  </code></pre>