Q:

(Find the Unicode of a character) Write a program that receives a character and displays its Unicode. Here is a sample run:

0

(Find the Unicode of a character) Write a program that receives a character and
displays its Unicode. Here is a sample run:

Output:

Enter a character: E
The Unicode for the character E is 69

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

/*
(Find the Unicode of a character) Write a program that receives a character and
displays its Unicode.
*/
import java.util.Scanner;

public class Exercise_04_09 {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);

		// Prompt the user to enter a character
		System.out.print("Enter a character: ");
		String s = input.nextLine();
		char ch = s.charAt(0);

		// Display Unicode of character
		System.out.println((int)ch);
	}
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now