title: Java input: Scanner or IOException
body: <p>I am taking a Java class at school and the teacher states that I should use an instance of the <code>Scanner</code> class to read input from the console. </p>
  
  <p>Example: </p>
  
  <pre><code>import java.util.Scanner;
  
  Public class ExampleName {
      public static void main(String[] args) {
          Scanner input = new Scanner(System.in);            
          char letter;
  
          letter = input.next().charAt(0);
      }
  }
  </code></pre>
  
  <p>However, I read <a href="https://rads.stackoverflow.com/amzn/click/com/0071809252" rel="nofollow noreferrer" rel="nofollow noreferrer">Java: A Beginner's Guide</a> over the summer and throughout the book it said to use <code>System.in.read()</code> to read input. </p>
  
  <p>Example: </p>
  
  <pre><code>import java.io.IOException;
  
  Public class ExampleChar {
      public static void main(String[] args) throws IOException {
          char letter;
  
          letter = (char) System.in.read();
      }
  }
  </code></pre>
  
  <p>Which form is correct? Which form should I use for getting basic input (char, int, double, etc....)?</p>