DoubleAdder floatValue() method in Java with Examples Last Updated : 28 Jan, 2019 Comments Improve Suggest changes Like Article Like Report The java.DoubleAdder.floatValue() is an inbuilt method in java that returns the sum() as an float after a narrowing primitive conversion. When the object of the class is created its initial value is zero. Syntax: public float floatValue() Parameters: This method does not accepts any parameter. Return Value: The method returns the numeric value represented by this object after conversion to float data type. Below programs illustrate the above method: Java // Program to demonstrate the floatValue() method import java.lang.*; import java.util.concurrent.atomic.DoubleAdder; public class GFG { public static void main(String args[]) { DoubleAdder num = new DoubleAdder(); // add operation on num num.add(11); num.add(10); // floatValue() operation on variable num num.floatValue(); // Print after floatValue() operation System.out.println("the value after floatValue() is: " + num); } } Output: the value after floatValue() is: 21.0 Java // Program to demonstrate the floatValue() method import java.lang.*; import java.util.concurrent.atomic.DoubleAdder; public class GFG { public static void main(String args[]) { DoubleAdder num = new DoubleAdder(); // add operation on num num.add(10); // floatValue() operation on variable num num.floatValue(); // Print after floatValue() operation System.out.println("the value after floatValue() is: " + num); } } Output: the value after floatValue() is: 10.0 Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/DoubleAdder.html#floatValue-- Comment More infoAdvertise with us Next Article DoubleAdder floatValue() method in Java with Examples T Twinkl Bajaj Follow Improve Article Tags : Misc Java Java-Functions Java-DoubleAdder Practice Tags : JavaMisc Similar Reads Float doubleValue() method in Java with examples The doubleValue() method of Float class is a built in method to return the value specified by the calling object as double after type casting. Syntax: FloatObject.doubleValue() Return Value: It return the double value of this Float object. Below programs illustrate doubleValue() method in Java: Prog 2 min read DoubleAccumulator floatValue() method in Java with Examples The Java.DoubleAccumulator.floatValue() is an inbuilt method in java that returns the current value as an float after a narrowing primitive conversion. It means the initial datatype is double which is explicitly converted into type float. Syntax: public float floatValue() Parameters: The function do 2 min read Byte floatValue() method in Java with examples The floatValue() method of Byte class is a built in method in Java which is used to return the value of this Byte object as float. Syntax ByteObject.floatValue() Return Value: It return the value of ByteObject as float. Below is the implementation of floatValue() method in Java: Example 1: Java // J 2 min read DoubleAdder intValue() method in Java with Examples The java.DoubleAdder.intValue() is an inbuilt method in java that returns the sum() as an int after a narrowing primitive conversion. When the object of the class is created its initial value is zero. Syntax: public int intValue() Parameters: This method does not accepts any parameter. Return Value: 1 min read Double floatValue() in Java with Examples The floatValue() method of Double class is a built-in method to return the value specified by the calling object as float after typecasting. Syntax: DoubleObject.floatValue() Return Type: It returns a float value i.e. the type casted value of the DoubleObject. Example 1: Java // Java Program to Impl 1 min read Like