字符变量charVar的值是“我”字。程序中输出了该字符的Unicode值以及Unicode值对应的十进制数值,并打印输出了charVar与一个int型变量做加法运算后的值
- public class Test {
- public static void main(String[] args) {
- int intResult,intVar=10;
- char charVar='我';
- intResult=intVar+charVar;
- System.out.println("The char is:"+charVar);
- System.out.println("The char`s Unicode is:\\u"+Integer.toHexString(charVar));
- System.out.println("The int value corresponding to the char is:"+
- new Integer(charVar).toString());
- System.out.println("Int "+intVar+" add the char,the result is: "+intResult);
- }
- }