0
Numeric value of character code coach
How to solve this problem in correct way? import java.util.Scanner; class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); char a = read.next().charAt(0); //your code goes here int b = (int) a; System.out.println(b); }
2 Respostas
+ 4
Scanner class is used to take input.
And this inputted character value is stored in variable "a".
It is then assigned to another integer variable "b" through explicit type casting i.e. (int) a =>means a character is explicitly type casted to an integer. And then it is printed.
0
Yeah, but test cases don't accept.