Why doesn’t the Scanner class have a nextChar method? [closed]

The reason is that the Scanner class is designed for reading in whitespace-separated tokens. It’s a convenience class that wraps an underlying input stream. Before scanner all you could do was read in single bytes, and that’s a big pain if you want to read words or lines. With Scanner you pass in System.in, and it does a number of read() operations to tokenize the input for you. Reading a single character is a more basic operation.
Source

You can use (char) System.in.read();.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)