bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Java/Java Reference
Java•Java Reference

Java Math nextUp() Method

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind Java Math nextUp() 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.nextUp(1.0f));
3Order

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

The nextUp() method returns the floating point number adjacent to a number in the positive direction, which is the lowest possible floating point number that is greater than the starting number.
Definition and Usage
Java Math nextUp() Method

❮ Math Methods

Example

System.out.println(Math.nextUp(1.0f));
System.out.println(Math.nextUp(1.0));
System.out.println(Math.nextUp(0.5f));
System.out.println(Math.nextUp(0.5));
System.out.println(Math.nextUp(Math.PI));
System.out.println(Math.nextUp(3.1415927f));

Definition and Usage

The nextUp() method returns the floating point number adjacent to a number in the positive direction, which is the lowest possible floating point number that is greater than the starting number. The return value for double type arguments will be closer to the starting number than the return value for float type arguments. Syntax One of the following: public static double nextUp(double start ) public static float nextUp(float start ) Parameter Values Parameter Description start Required. The number to start from. Technical Details Returns: A double or float value representing the floating point number adjacent to a starting number in the positive direction. Java version: 1.6+ ❮ Math Methods

The return value for double type arguments will be closer to the starting number than the return value for float type arguments. Syntax One of the following: public static double nextUp(double start ) public static float nextUp(float start ) Parameter Values Parameter Description start Required. The number to start from. Technical Details Returns: A double or float value representing the floating point number adjacent to a starting number in the positive direction. Java version: 1.6+ ❮ Math Methods

The return value for double type arguments will be closer to the starting number than the return value for float type arguments.

One of the following

public static double nextUp(double
start )
public static float nextUp(float
start )

Parameter Values

ParameterDescription
startRequired. The number to start from.

Technical Details

Returns:A double or float value representing the floating point number adjacent to a starting number in the positive direction.
Java version:1.6+

Previous

Java Math nextDown() Method

Next

Java Math pow() Method