The java.util.Math.sqrt(double a) method returns the square root of a given number 'a' as a double value. It is a static method, so it can be called directly from the Math class without needing to create an object of the Math class.
Example:
double num = 16.0; double sqrt = Math.sqrt(num); System.out.println("The square root of " + num + " is " + sqrt);
Output:
The square root of 16.0 is 4.0
This method is part of the java.util package library, which is a collection of utility classes and methods for performing common programming tasks in Java. The java.util package is part of the Java Standard Library, which is included with every installation of Java.
Java Math.sqrt - 30 examples found. These are the top rated real world Java examples of java.util.Math.sqrt extracted from open source projects. You can rate examples to help us improve the quality of examples.