title: how to resolve the error while using Scanner class in java
body: <p>I have created a class "My" in which i am simply taking input from user using Scanner class"</p>
  
  <pre><code>import java.util.Scanner;
  
  class My
  {
      public static void main(String[] args)
      {
           int val;
           Scanner sc = new Scanner(System.in);
           System.out.println("Enter no = ");
           val= sc.nextInt();
  
           System.out.println("number " + val);
      }
  }
  </code></pre>
  
  <p>But I am getting following errors:</p>
  
  <pre><code>My.java:1: cannot resolve symbolsymbol  : class Scanner
  location: package util
  import java.util.Scanner;
  
  My.java:8: cannot resolve symbol
  symbol  : class Scanner
  location: package util
   java.util.Scanner scanner = new java.util.Scanner(System.in);
  
  My.java:8: cannot resolve symbol
  symbol  : class Scanner
  location: package util
   java.util.Scanner scanner = new java.util.Scanner(System.in);
  </code></pre>