This is a very simple program. It will be used to find the ASCII value of any character.
Input a character from the user and display its ASCII value on the screen.
- The program inputs a string from the user at line 11. We have taken a string as an input because we can not directly take a character from the user as input.
- At the line 12, the ASCII code is determined and displayed on the screen. Actually first string is converted to char using charAt() function and then that char is converted to its ASCII value by placing (int) before it. Remember that we can convert a char to int which will store the char’s ASCII value in the int.