Java Program to Find ASCII Value of a character
mrt481 0.9K 28th Aug, 2022
Loading Please wait...
Description
In the above program, character a is stored in a char variable, ch. Like, double quotes (" ") are used to declare strings, we use single quotes (' ') to declare characters. Now, to find the ASCII value of ch, we just assign ch to an int variable ascii. Internally, Java converts the character value to an ASCII value. We can also cast the character ch to an integer using (int). In simple terms, casting is converting variable from one type to another, here char variable ch is converted to an int variable castAscii. Finally, we print the ascii value using the println() function.
Recent Pastes
- C++ Program to Add Two Numbers
C++ | 6.1K | 1 year ago
- C++ Program to Print Number Entered by User
C++ | 3.6K | 1 year ago
- C++ "Hello, World!" Program
C++ | 2.6K | 1 year ago
Please disable your adblock and script blockers to view this page