Reputation: 59
so I want to cast from an integer to a character, like 65 to A, but when I do System.out.println((char)65);
it prints out in eclipse a box with a question mark in it.
How can I cast from an int to a char? Thanks!
Upvotes: 0
Views: 148
Reputation: 36304
public static void main(String args[]) {
char c = (char) 65;
System.out.println(c);
}
O/P : A
public static void main(String args[]) {
//char c = (char) 65;
System.out.println((char)65 );
}
O/ P : A
Its working right?. This should work. Check your character encoding.
Upvotes: 1