Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » Java » Programs » ASCII value of any char

Java program to print ascii value of any char

import java.util.Scanner;

public class Main
{
	public static void main(String[] args) {
	    Scanner read = new Scanner(System.in);
		String str = read.nextLine();
        int ascii = (int) str.charAt(0);
        System.out.println("ASCII value is : " + ascii);
	}
}