The Math class has many methods that allow you to perform mathematical operations on numbers. Let’s start covering the basic methods below.

Finding the absolute value

Java provides the abs() method, which returns the absolute value of the argument passed to it. The absolute value is the positive value of a number.

Run the program below.

Get hands-on with 1200+ tech skills courses.