Java Number Class Tutorial
java.lang.Number is the superclass of BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, and Short class.
Java Number Class Example
package java; public class Number { public static void main(String[] args) { Integer x = new Integer(123456); Float y = new Float(9876f); System.out.println("x as integer:" + x + ", x as byte:" + x.byteValue()); System.out.println("y as float:" + y + ", y as byte:" + y.byteValue()); } }
OUTPUT:
x as integer:123456, x as byte:64 y as float:9876.0, y as byte:-108