Hello,
The char is always a character and not the code that is displayed (Means that your console does not support this character). To display the value of its code should display it as a int :
Code:
System.out.System.out.println( (int)s.charAt(0) );
This gives you 1576 (base 10).
And for the unicode just convert in base 16, for example:
Code:
System.out.System.out.println( Integer.toHexString(s.charAt(0)) );
Display 628
Or with Java 5 and the method printf ():
Code:
System.out.printf( "% 04x", (int)s.charAt(0) );
Bookmarks