Java StrictMath.sqrt(double a)

Syntax

StrictMath.sqrt(double a) has the following syntax.

public static double sqrt(double a)

Example

In the following code shows how to use StrictMath.sqrt(double a) method.


public class Main {
//www  . jav  a 2  s  . c o  m
  public static void main(String[] args) {
  
    double d1 = 123, d2 = -456, d3 = 0.0;

    System.out.println("square root of " + d1 + " = " + StrictMath.sqrt(d1));
        
    System.out.println("square root of " + d2 + " = " + StrictMath.sqrt(d2));
        
    System.out.println("square root of " + d3 + " = " + StrictMath.sqrt(d3));
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable