Java Data Type Tutorial - Byte floatValue() example








Byte floatValue() returns the Byte as a float.

Syntax

floatValue has the following syntax.

public float floatValue()

Specified by

floatValue in class Number

Return

floatValue returns the float value from byte.

Example

In the following code shows how to use Byte.floatValue() method.

public class Main {
  public static void main(String[] args) {
    Byte byteObject = new Byte("10");
    float f = byteObject.floatValue();
    System.out.println("float"+f);

  }
}

The output: