Java.lang.Byte.longValue() 方法


Java.lang.Byte.longValue() 方法

package com.codingdict;



import java.lang.*;



public class ByteDemo {



   public static void main(String[] args) {



      // create 2 Byte objects b1, b2

      Byte b1, b2;



      // create 2 long l1, l2

      long l1, l2;



      // assign values to b1, b2

      b1 = new Byte("127");

      b2 = new Byte("-128");



      // assign long values of b1, b2 to l1, l2

      l1 = b1.longValue();

      l2 = b2.longValue();



      String str1 = "long value of Byte " + b1 + " is " + l1;

      String str2 = "long value of Byte " + b2 + " is " + l2;



      // print l1, l2 values

      System.out.println( str1 );

      System.out.println( str2 );

   }

}