>  기사  >  Java  >  Java에서 StrictMath 클래스의 목적은 무엇입니까?

Java에서 StrictMath 클래스의 목적은 무엇입니까?

PHPz
PHPz앞으로
2023-09-12 21:21:021319검색

Java에서 StrictMath 클래스의 목적은 무엇입니까?

java.lang.StrictMathObject 클래스의 하위 클래스인 최종 클래스입니다. StrictMath 클래스에는 기본 지수, 로그, 제곱근삼각 함수와 같은 기본 수치 연산을 수행하는 메서드가 포함되어 있습니다. StrictMath 클래스의 모든 메서드는 정적 메서드이므로 StrictMath 클래스에 대한 인스턴스를 만들 필요가 없습니다. StrictMath 클래스의 중요한 메소드는 abs(), acos(), asin(), atan(), ceil(), Floor(), log(), max(), min(), pow(), random()입니다. ), round() etc

구문

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

위 내용은 Java에서 StrictMath 클래스의 목적은 무엇입니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
이 기사는 tutorialspoint.com에서 복제됩니다. 침해가 있는 경우 admin@php.cn으로 문의하시기 바랍니다. 삭제