Boolean[] a = new Boolean[4];
int i = 1;
System.out.println(a[i]);
boolean[] b = new boolean[4];
int j = 1;
System.out.println(b[j]);
打印:
null
false
String str = "abc中文123";
byte[] hz=str.getBytes("GBK");
则 str.length = 8; hz.length = 10;
for (int i = 0; i < hz.length ; i++)
{
System.out.println(hz[i]);
}
输出结果为:
97
98
99
-42
-48
-50
-60
49
50
51
即中文部分得到的字节都为负值.GBK字符集中,用两个字节来表示一个中文,为与ASCII字符相区别,其每个字节的最高位均为1,(ASCII的值范围为0-127,128到255为中文,但JAVA里没有unsigned 类型,故得到的值为负数).
class Greebo extends Vector implements Runnable{
public void run(String message){
System.out.println("in n..." + message);
}
}写法错误, Runnable没有这个里面带字符串的方法,企业就喜欢考这些东西。