tags:

views:

166

answers:

2

I'm new with Java and just learning... but how would you write a program that receives an ASCII code and displays its character. For example, if the user enters 97,the program displays character a.

+3  A: 
int i = 97;
char c = (char)i; //c will contain 'a'
Soufiane Hassou
+1  A: 

Use Integer.parseInt(string) to turn that 97 into an integer. You can then explicitly cast that into a char:

String asciiCode = "97";
(char)Integer.parseInt(asciiCode);
Aaron