Current location - Training Enrollment Network - Mathematics courses - How to call the method in Math in Java
How to call the method in Math in Java
Methods in mathematics classes are generally static methods, which can be called directly with class name and method name (parameter list). For example, the statement calling the max function in Math is Math.max (3,5); It returns the larger value in 3.5.

Math class contains methods to perform basic mathematical operations, such as initial exponent, logarithm, square root and trigonometric function. Math class is a package imported by default in java.lang, so you don't need to import additional packages when using it. .