Java Program to find ASCII value of a Character.

public class Demo {

    public static void main(String[] args) {

        char ch = 'P';
        int asciiCode = ch;
        // type casting char as int
        int asciiValue = (int)ch;

        System.out.println("ASCII value of "+ch+" is: " + asciiCode);
        System.out.println("ASCII value of "+ch+" is: " + asciiValue);
    }
}
Java Program to find ASCII value of a Character. Java Program to find ASCII value of a Character. Reviewed by on December 20, 2019 Rating: 5

No comments:

Powered by Blogger.