Java program to find ascii value of a character
www.igiftedia.com
Here's a Java program to find the ASCII value of a character:
public class AsciiValue {
public static void main(String[] args) {
char c = 'A';
int asciiValue = (int) c;
System.out.println("The ASCII value of " + c + " is " + asciiValue);
}
}
In this program, we first define a character c and then use a typecast to convert it to an integer, which gives us the ASCII value of the character. We then print a message to the console indicating the character and its corresponding ASCII value.
You can modify the value of c to find the ASCII value of a different character. Note that some characters do not have an ASCII value, such as characters from non-ASCII character sets like Unicode. In Java, you can use the codePointAt method of the String class to find the Unicode code point of a character, which is a similar concept to the ASCII value but works for a wider range of characters.
