java.lang.Byte.intValue()%uA0返回此字节为一个int值。
声明
以下是java.lang.Byte.intValue()方法的声明
public int intValue()
指定
intValue 在类%uA0Number
参数
-
NA
返回值
此方法将返回转换为int类型后该对象表示的数值。
异常
-
NA
例子
下面的例子显示lang.Byte.intValue()方法的使用。
package com.yiibai import java.lang.* public class ByteDemo { public static void main(String[] args) { // create 2 Byte objects b1, b2 Byte b1, b2 // create 2 int i1, i2 int i1, i2 // assign values to b1, b2 b1 = new Byte("123") b2 = new Byte("-32") // assign int values of b1, b2 to i1, i2 i1 = b1.intValue() i2 = b2.intValue() String str1 = "int value of Byte " + b1 + " is " + i1 String str2 = "int value of Byte " + b2 + " is " + i2 // print i1, i2 values System.out.println( str1 ) System.out.println( str2 ) } }
让我们来编译和运行上面的程序,这将产生以下结果:
int value of Byte 123 is 123 int value of Byte -32 is -32