Java の StrictMath クラスの目的は何ですか?

PHPz
リリース: 2023-09-12 21:21:02
転載
1347 人が閲覧しました

Java の StrictMath クラスの目的は何ですか?

java.lang.StrictMath は、Object クラスのサブクラスである最終クラスです。 StrictMath クラスには、基本的な指数、対数、平方根、三角関数などの基本的な数値演算を実行するためのメソッドが含まれています。 StrictMath クラスのすべてのメソッドは 静的メソッドであるため、StrictMath クラスのインスタンスを作成する必要はありません。 StrictMath クラスの重要なメソッドは、abs()、acos()、asin()、atan()、ceil()、floor()、log()、max()、min()、pow()、random( )、round() etc構文

public final class StrictMath extends Object
ログイン後にコピー

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));
   }
}
ログイン後にコピー

出力

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 中国語 Web サイトの他の関連記事を参照してください。

ソース:tutorialspoint.com
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
最新の問題
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!