0% found this document useful (0 votes)
79 views

Math

The Java.lang.Math class contains static methods for basic numeric operations and is imported by default. It has fields for E and PI and methods like round, min, max, and abs that return the closest integer, smaller value, larger value, and absolute value respectively for primitive types like int, long, and float.

Uploaded by

api-3704028
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views

Math

The Java.lang.Math class contains static methods for basic numeric operations and is imported by default. It has fields for E and PI and methods like round, min, max, and abs that return the closest integer, smaller value, larger value, and absolute value respectively for primitive types like int, long, and float.

Uploaded by

api-3704028
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Java.lang.

Math

‡ Final class
‡ exetnds object
‡ imported by default
‡ contains methods for performing basic numeric operations
such as the elementary exponential, logarithm, square root, and
trigonometric functions

Fields
static double E
static double PI
Methods

‡ static int round(float a)


Returns the closest int to the argument.
‡ static int min(int a, int b)Returns the
smaller of two int values.
‡ static int max(int a, int b)
Returns the greater of two int values.
‡ static int abs(int a)
Returns the absolute value of an int value.
‡ static long min(long a, long b)
Returns the smaller of two long values.
‡static long max(long a, long b)
Returns the greater of two long values.
‡static long abs(long a)
Returns the absolute value of a long value
static float abs(float a)
Returns the absolute value of a float value.
static float min(float a, float b)
Returns the smaller of two float values

Note :
Only above those methods are show which are static and
have return type of float , long and int.

You might also like