java.lang.Short floatValue()


The floatValue() method of Short class returns the value of this Short as a float after a widening primitive conversion.

Important Notes:

  • This method is specified by floatValue in class Number.

Method Syntax

public float floatValue()

Method Argument

Data Type Parameter Description

Method Returns

The floatValue() method of Short class returns the numeric value represented by this object after conversion to type float.


Requires Java 1.1 and up

Java Short floatValue() Example

Below is a simple java example on the usage of floatValue() method of Short class.


 * This example source code demonstrates the use of  
 * floatValue() method of Short class

public class ShortFloatValueExample {

	public static void main(String[] args) {

		// Declare a new Short variable
		Short value = 175;

		// get the floatValue() method result
		double result = value.floatValue();

		// print the result
		System.out.println("Result:" + result);
		 * Be careful on using this method
		 * Desired result might differ
		 * because of the widening concept
		 * of java language



Sample Output

Below is the sample output when you run the above example.

Java Short floatValue method example output