title: How does System.in() work?
body: <p>I have written a code to accept a char and a string:</p>
  
  <pre><code>    public static void main(String[] args) throws IOException {
      System.out.println("enter one char");
      char c = (char) System.in.read();
      System.out.println("The char entered is :" + c);
      String userInput;
      System.out.println("Enter a string");
      Scanner s = new Scanner(System.in);
      userInput = s.next();
      System.out.println("the string inputted is:" + userInput);}
  </code></pre>
  
  <p><strong>output:</strong></p>
  
  <pre><code>enter one char
  asdfg
  The char entered is :a
  Enter a string
  the string inputted is:sdfg
  </code></pre>
  
  <p>Can anyone explain why is it so?</p>