KnowledgeBoat Logo
|

Computer Applications

Write down the syntax to input a character through scanner class with an example.

Input in Java

123 Likes

Answer

Syntax:

char <variable name> = <Scanner Object>.next().charAt(0);

Example:

Scanner in = new Scanner(System.in);
char ch = in.next().charAt(0);

Answered By

73 Likes


Related Questions