java.lang.Number.shortValue()


java.lang.Number.shortValue()

package com.codingdict;



public class NumberDemo {



   public static void main(String[] args) {



      // get a number as float

      Float x = new Float(123456f);



      // get a number as double

      Double y = new Double(9876);



      // print their value as short

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

         + ", x as short:" + x.shortValue());

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

         + ", y as short:" + y.shortValue());

   }

}