Math.sqrt()

Java Math.sqrt() method

Last Updated : 17 Mar 2025

The java.lang.Math.sqrt() is used to return the square root of a number.

Syntax

Parameter

Return

  • If the argument is positive double value, this method will return the square root of a given value.
  • If the argument is NaN or less than zero, this method will return NaN.
  • If the argument is positive infinity, this method will return positive Infinity.
  • If the argument is positive or negative Zero, this method will return the result as Zero with same sign.

Example 1

Output:

Example 2

Output:

Example 3

Output:

Example 4

Output:

Example 5

Output:

  
 

Related Posts


Subscribe to Tpoint Tech

We request you to subscribe our newsletter for upcoming updates.