Write a  Java Program to Find ASCII Value of a character

Java Program to Find ASCII Value of a character

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn Java programming concepts. You can learn Java  language at your own speed and time. One can learn concepts of Java language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Write a

Java Program to Find ASCII Value of a character
Java Program to Find ASCII Value of a character

PROGRAM: Java Program to Find ASCII Value of a character

/* Java Program to Find ASCII Value of a character */

public class AsciiValue {

public static void main(String[] args) {

char ch = ‘a’;
int ascii = ch;
// You can also cast char to int
int castAscii = (int) ch;

System.out.println(“The ASCII value of ” + ch + ” is: ” + ascii);
System.out.println(“The ASCII value of ” + ch + ” is: ” + castAscii);
}
}

OUTPUT;- The ASCII value of a is: 97
                     The ASCII value of a is: 97

 

Leave a Reply

Your email address will not be published. Required fields are marked *