Home » Java Float max() method with Examples

Java Float max() method with Examples

by Online Tutorials Library

Java Float max() Method

The max() method of Java Float class returns the float having greater value between two float values. The returned result is same as by invoking Math.max() method.

Syntax:

Parameters:

Here, a & b are the two operands to be compared.

Return Value:

The max() method returns the greater value between a and b.

Example 1

Test it Now

Output:

Enter first number.  90.7658  Enter second number  90.84375  The Max value is: 90.84375  

Example 2

Test it Now

Output:

Enter total number of elements  4  Enter 4 elements  90.99  90.11  9  8  Maximum value: 90.99  

Example 3

Test it Now

Output:

Enter number of elements you want.  5  Enter elements  90.99  98  123  11  2  Ascending order = 2.0,11.0,90.99,98.0,123.0,  

Next TopicJava Float

You may also like