Java Online Compiler
Example: Java program to find the ASCII value of a character
C
C++
C#
Java
Python
PHP
Main.java
STDIN
Run
// Java program to find the ASCII value of a character import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter a character::\n"); char p = in.next().charAt(0); int pAscii = p; // Output System.out.println("\nASCII value of " + p + " = " + pAscii); } }
h
Output
Clear
ADVERTISEMENTS