Flash cards
Review the key moves
1/4
Core idea
What is the main idea behind Java Math abs() 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.abs(-4.7));3Order
Put the learning moves in the order that makes the concept easiest to apply.
The abs() method returns the absolute (positive) value of a number.
Definition and Usage
Java Math abs() Method
❮ Math Methods
Example
System.out.println(Math.abs(-4.7));
System.out.println(Math.abs(4.7));
System.out.println(Math.abs(3));Definition and Usage
The abs() method returns the absolute (positive) value of a number.
One of the following
public static double abs(double
number )public static float abs(float
number )public static int abs(int
number )public static long abs(long
number )Parameter Values
| Parameter | Description |
|---|---|
| number | Required. Specifies a number |
Technical Details
| Returns: | A double , float , int or long value representing the absolute value of the specified number |
|---|