public class Output {
public static void main(String args[]) throws NumberFormatException {
System.out.println(Byte.parseByte("11",16));
}
}
上面的程序输出为17,但是如果换成System.out.println(Byte.parseByte("f2",16));时会出错,
如何才能得到该值呢?
public static void main(String args[]) throws NumberFormatException {
System.out.println(Byte.parseByte("11",16));
}
}
上面的程序输出为17,但是如果换成System.out.println(Byte.parseByte("f2",16));时会出错,
如何才能得到该值呢?
System.out.println(Byte.parseByte("80",16))就报错了。
Java是有符号的,byte最多到127