*4.9 (Find the Unicode of a character) Write a program that receives a character and displays its Unicode. Here is a sample run:
Enter a character: E
The Unicode for the character E is 69
Enter a character: E
The Unicode for the character E is 69
import java.util.Scanner; public class ProgrammingEx4_9 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a character: "); String s = input.nextLine(); char ch = s.charAt(0); System.out.print("The Unicode for the character " + ch + " is " + (int) ch); } }
No comments :
Post a Comment