title: Error in reading double and string value from standard input?
body: <p>Here is my code:</p>
  
  <pre><code>public class Solution {
      public static void main(String[] args) {
          /*
           * Enter your code here. Read input from STDIN.
           * Print output to STDOUT.
           * Your class should be named Solution.
           */
          int num = 0;
          double dou = 0.0;
          String s = null;
          Scanner in = new Scanner(System.in);
          if (in.hasNextInt()) {
              num = in.nextInt();
          }
  
          Scanner d = new Scanner(System.in);
          if (d.hasNextDouble()) {
              dou = d.nextDouble();
          }
  
          Scanner str = new Scanner(System.in);
          if (str.hasNextLine()) {
              s = str.nextLine();
          }
  
          System.out.println("String:" + s);
          System.out.println("Double:" + dou);
          System.out.println("Int:" + num);
      }
  }
  </code></pre>
  
  <p>I am getting this output:</p>
  
  <blockquote>
    <p>String:null<br>
    Double:0.0<br>
    Int:42</p>
  </blockquote>
  
  <p>But it should should look like this:</p>
  
  <blockquote>
    <p>String: Welcome to Hackerrank Java tutorials!<br>
    Double: 3.1415<br>
    Int: 42</p>
  </blockquote>
  
  <p>Can anyone explain me why I'm getting a <code>null</code> value for the string and <code>0.0</code> for the double?</p>