iodemo13.java

来自「JAVA的一些基础教程」· Java 代码 · 共 25 行

JAVA
25
字号
public class IODemo13
{
	public static void main(String arg[]) throws Exception
	{
		char 你 = '你';
		char 好 = '好';

		int GBK你 = 0xC4E3;
		int GBK好 = 0xBAC3;

		System.out.println("UNICODE的你好的值");
		System.out.print(你 + " = " + Integer.toHexString(你 & 0xFFFF) + "\n");
		System.out.print(好 + " = " + Integer.toHexString(好 & 0xFFFF) + "\n");

		System.out.println("\nGBK的你好的值");
		System.out.write(GBK你 >> 8);
		System.out.write(GBK你 & 0xFF);
		System.out.println("= " + Integer.toHexString(GBK你& 0xFFFF));

		System.out.write(GBK好 >> 8);
		System.out.write(GBK好 & 0xFF);
		System.out.println("= " + Integer.toHexString(GBK好& 0xFFFF));
		
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?