该方法的作用是以byte类型返回该 Integer 的值。只取低八位的值,高位不要。
函数原型:
public byte byteValue()
所属包:
java.lang.Integer
示例:
public class IntegerDemo {
public static void main(String[] args) {
Integer obj = new Integer(10);
// returns the value of Integer as a byte
byte b = obj.byteValue();
System.out.println("Value of b = " + b);//输出Value of b = 10
}
}