In this section, you will learn to convert a character data into the ASCII format. The java.lang package provides the functionality to convert the character data into the ASCII format
Description of Code:
The following program helps in converting a character data into ASCII. Create a class "CharToASCII". This program takes a character at the console . It fragments the given string according to its positions with the help of charAt() method. This method returns the character at the specified index. Type casting ((int) c) is done to convert the character into an ASCII.
Here is the code of this program:
Output of this program.
Enter the char:
ASCII OF A = 65.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial