- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the use of StrictMath class in Java?n
The java.lang.StrictMath is a final class and it is a subclass of Object class. The StrictMath class contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions. We need not create an instance for StrictMath class because all the methods in StrictMath class are static methods. The important methods of StrictMath class are abs(), acos(), asin(), atan(), ceil(), floor(), log(), max(), min(), pow(), random(), round() and etc.
Syntax
public final class StrictMath extends Object
Example
public class StrictMathTest { public static void main(String args[]) { System.out.println("Absolute Value: " + StrictMath.abs(-100.50)); System.out.println("Ceil Value : " + StrictMath.ceil(100.55)); System.out.println("Floor Value : " + StrictMath.floor(100.55)); System.out.println("Maximum Value : " + StrictMath.max(100,200)); System.out.println("Minimum Value : " + StrictMath.min(100,200)); System.out.println("Random Value : " + StrictMath.random()); System.out.println("Round Value: " + StrictMath.round(100.75)); System.out.println("Square Root Value : " + StrictMath.sqrt(2)); System.out.println("PI Value: " + StrictMath.PI); System.out.println("Log Value: " + StrictMath.log(10.55)); } }
Output
Absolute Value: 100.5 Ceil Value : 101.0 Floor Value : 100.0 Maximum Value : 200 Minimum Value : 100 Random Value : 0.22227639516105102 Round Value: 101 Square Root Value : 1.4142135623730951 PI Value: 3.141592653589793 Log Value: 2.3561258599220753
- Related Articles
- What is the use of StrictMath class in Java?
- What is the use of the Cleaner class in Java 9?
- What is the use of %n in printf()?
- What is the use of in flush() and close() methods of BufferedWriter class in Java?
- What is the class "class" in Java?
- What is the super class of every class in Java?
- What is the importance of SwingUtilities class in Java?
- What is the importance of JViewport class in Java?
- What is the importance of JSeparator class in Java?
- What is the importance of Runtime class in Java?
- What is the importance of Boolean class in Java?
- What is the purpose of Process class in Java?
- What is the purpose of System class in Java?
- What is the purpose of Runtime class in Java?
- What is the importance of the GridBagConstraints class in Java?
- What is the importance of the CardLayout class in Java?

Advertisements