0
import java.util.Scanner;
class main
{  public static void main(String[] args)
   {
    Scanner s =new Scanner(System.in);//Initializing scanner
    System.out.println("Your Answer: ");
    char ans = s.nextChar();//it is showing cannot identify symbol
   }
}

Is there any problem with the code? I am getting an error 'cannot find symbol' 'method nextChar();'

  • 1
    So why didn't you go look at the javadocs for that class and see what methods it offers? – Mat Aug 17 '17 at 07:02
  • https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html – jmj Aug 17 '17 at 07:02
  • 1
    If you look at the javadocs https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html you will that there is not such method - what exactly do you want to acheive? – Scary Wombat Aug 17 '17 at 07:02

0 Answers0