title: Using CoderPad, why do I get a NoSuchElementException using a Scanner on System.in?
body: <p>I am preparing for an interview I have in a few days. I was told that I should familiarize myself with <a href="https://coderpad.io" rel="nofollow">CoderPad</a> since that is the collaborator I will be interviewed with. However, I was in the middle of answering a question when I realized I could not read input from System.in using the Scanner class.</p>
  
  <p>For example, running the following:</p>
  
  <pre><code>import java.io.*;
  import java.util.*;
  
  /*
   * To execute Java, please define "static void main" on a class
   * named Solution.
   *
   * If you need more classes, simply define them inline.
   */
  
  class Solution {
    public static void main(String[] args) {
      Scanner in = new Scanner(System.in);
      String s = in.next();
      System.out.println(s);
    }
  }
  </code></pre>
  
  <p>Gives me the message:</p>
  
  <pre><code>Exception in thread "main" java.util.NoSuchElementException
      at java.util.Scanner.throwFor(Scanner.java:862)
      at java.util.Scanner.next(Scanner.java:1371)
      at Solution.main(Solution.java:14)
  </code></pre>
  
  <p>What's going on here?</p>