public class CharToInt
{
public static void main(String args[])
{
int intResult ,intVar=10;
char charVar='语';
intResult=intVar+charVar;
System.out.println("The char's Unicode is:"+Integer.toHexString(charVar)); //这是非曲直强制转换吗?
System.out.println("The int value corresponding to the char is:"+new Integer(charVar).toString()); //最不理解的就是这个了,求解中…
}
} 结果:
The char's Unicode is: 8bed
The int value corresponding to the char is: 35831
{
public static void main(String args[])
{
int intResult ,intVar=10;
char charVar='语';
intResult=intVar+charVar;
System.out.println("The char's Unicode is:"+Integer.toHexString(charVar)); //这是非曲直强制转换吗?
System.out.println("The int value corresponding to the char is:"+new Integer(charVar).toString()); //最不理解的就是这个了,求解中…
}
} 结果:
The char's Unicode is: 8bed
The int value corresponding to the char is: 35831
char 变量好像是保存这个字符的什么值吧.区位码还是别的什么的..
以十六进制的无符号整数形式返回一个整数参数的字符串表示形式。
这个看API就可以了
...
郑码: SBXJ Unicode: 8BED GBK D3EF
笔画数: 9, 部首: 讠 笔画顺序: 451251251