public class test {
public static void main(String[] args)
{
char c = '';
char d = 12;
byte[] b = new byte[]{(byte) (c&0xff),(byte) (c>>8&0xff)};
System.out.println(Integer.toHexString(b[1])+":"+Integer.toHexString(b[0]));
System.out.println("");
System.out.println(d);
System.out.println(d);
}
}
这么看,代码本身是不会报错,不知道LZ是要完成什么需求?
呵呵 简单方法 贴到eclipse里看一下 就知道 。
测试一下: 没报错 运行正常。
跑一下呗~
无论是看、还是运行,都不会报错
结果:
0:20
如果是看,不报错才怪。
char c = '';