1public class AsciiValue {
2
3 public static void main(String[] args) {
4
5 char ch = 'z';
6 int ascii = ch;
7 // You can also cast char to int
8 int castAscii = (int) ch;
9
10 System.out.println("The ASCII value of " + ch + " is: " + ascii);
11 System.out.println("The ASCII value of " + ch + " is: " + castAscii);
12 }
13}
1public class AsciiValue {
2
3 public static void main(String[] args) {
4
5 char ch = 'a';
6 int ascii = ch;
7 // You can also cast char to int
8 int castAscii = (int) ch;
9
10 System.out.println("The ASCII value of " + ch + " is: " + ascii);
11 System.out.println("The ASCII value of " + ch + " is: " + castAscii);
12 }
13}