The `final` class `Math` defines a set of `static` methods to support common mathematical functions, including functions for rounding numbers, performing trigonometry, generating pseudo random numbers, finding maximum and minimum of two numbers, calculating logarithms and exponentiation. The `Math` class cannot be instantiated. Only the class name `Math` can be used to invoke the static methods.

The `final` class `Math` provides constants to represent the value of e, the base of the natural logarithms, and the value π (pi), the ratio of the circumference of a circle to its diameter:

Math.E Math.PI

static int abs(int i) static long abs(long l) static float abs(float f) static double abs(double d)

Start Free Trial

No credit card required