java.lang.Number.floatValue()


java.lang.Number.floatValue()

package com.codingdict;



public class NumberDemo {



   public static void main(String[] args) {



      // get a number as integer

      Integer x = new Integer(123456);



      // get a number as double

      Double y = new Double(9876);



      // print their value as float

      System.out.println("x as integer:" + x

         + ", x as float:" + x.floatValue());

      System.out.println("y as double:" + y

         + ", y as float:" + y.floatValue());

   }

}