-3

if you are using integer you use int age = input.nextInt();

and if you are using strings you use int name = input.nextLine();

what do you use for char?

Rajesh Dhiman
  • 1,888
  • 16
  • 29
  • WHy not just look at the API specification on what is available? http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Scanner.html easiest way for non-multibyte encodings: Use `nextByte()`and cast it to a char. – Johannes H. Feb 23 '14 at 19:08
  • thank you very much it has worked – user3343348 Feb 23 '14 at 19:17

1 Answers1

1

FOr ASCII-only:

char myChar = (char) input.nextByte();
Johannes H.
  • 5,554
  • 1
  • 18
  • 39