Computer Science, asked by mdsahil77866, 3 months ago

how to accept a charecter from scanner object in java​

Answers

Answered by rubhang
0

Answer: We need to use the next() method to read a single character as a string and then use charAt(0) to get the first character of that string. Scanner scanner = new Scanner(System.in); char ch = scanner. next(). charAt(0).

I hope this answer is helpful for you.

Similar questions