Java sqrt()
Method with Examples
The sqrt()
method in Java is part of the Math
class and is used to calculate the square root of a number. It returns a double value and accepts a positive number or zero as input. If the input is negative, it returns NaN
.
Syntax:
Examples:
This method is commonly used in mathematical calculations, geometry, and scientific applications.