Java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a character: ");
char ch = sc.next().charAt(0);
int ascii = (int) ch;
System.out.println("ASCII value of " + ch + " = " + ascii);
sc.close();
}
}Output
Enter a character: A ASCII value of A = 65
In Java, char is internally stored as a number (Unicode code point). Casting the char to int reveals its numeric ASCII/Unicode value.