title: Why is there an Exception in thread "main" java.util.NoSuchElementException?
body: <p>This is my code:</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Distribution{
  
       public static void main(String []args){
          System.out.println("How many cards to be distributed? ");
          Scanner keyboard = new Scanner(System.in);
          int cards = keyboard.nextInt();
       }
  }
  </code></pre>
  
  <p>When I run it, it gives me an exception in thread <code>main</code>:</p>
  
  <p><code>java.util.NoSuchElementException</code>. </p>
  
  <p>Why is this happening, and how can I fix it?</p>