bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java Math min() Method

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Java Math min() Method?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___.out.println(Math.min(2.0, 0.25));
3Order

Put the learning moves in the order that makes the concept easiest to apply.

The min() method returns the number with the lowest value from a pair of numbers.
Definition and Usage
Java Math min() Method

❮ Math Methods

Example

System.out.println(Math.min(2.0, 0.25));
System.out.println(Math.min(31.2f, 18.0f));
System.out.println(Math.min(14, 22));
System.out.println(Math.min(96L, 2048L));

Definition and Usage

The min() method returns the number with the lowest value from a pair of numbers.

Tip

Use the max() method to return the number with the highest value.

One of the following

public static double min(double
x , double
y )
public static float min(float
x , float
y )
public static int min(int
x , int
y )
public static long min(long
x , long
y )

Parameter Values

ParameterDescription
xRequired. A number.
yRequired. A number.

Technical Details

Returns:A double , float , int or long value representing the lowest of two numbers.
Java version:Any

Previous

Java Math max() Method

Next

Java Math multiplyExact() Method