Java program to find the ASCII value of a input taken from user


This program will find the ASCII value of an input taken from the user.

In these characters is typecast into an integer to get ASCII Value.

Program
import java.util.*; public class Ascii { public static void main(String[] args) { Scanner s=new Scanner(System.in); System.out.println("Enter a character"); char ch = s.next().charAt(0); int ascii = (int) ch; System.out.println("The ASCII value of " + ch + " is: " + ascii); } }
Input
Output