It doesn’t work because .next() returns a String.
Instead, read the first character of the string returned.
Scanner input = new Scanner(System.in);
String temp = input.nextLine();
char ch = temp.charAt(0);
int a = (int) ch;
System.out.println(a);
0
solved java convert a english letter to unicode [closed]