public class Main {
public static void main(String[] args) {
char asciiChar = 'A';
int asciiValue = (int) asciiChar; // Convert to ASCII value
String hexValue = Integer.toHexString(asciiValue); // Convert to hex
System.out.println("The hexadecimal value of '" + asciiChar + "' is: 0x" + hexValue);
}
}
/*
run:
The hexadecimal value of 'A' is: 0x41
*/