Check out example codes for "math sqrt java". It will help you in understanding the concepts better.

Code Example 1

import java.math.*;
double x=144;
double y=math.sqrt(x); //You can only pass double numbers not float

Code Example 2

import java.lang.Math;

double x = Math.sqrt(9);

Code Example 3

// Java program to demonstrate working 
// of java.lang.Math.sqrt() method 
import java.lang.Math; 
  
class Gfg { 
  
    // driver code 
    public static void main(String args[]) 
    { 
        double a = 30; 
  
        System.out.println(Math.sqrt(a)); 
  
        a = 45; 
  
        System.out.println(Math.sqrt(a)); 
  
        a = 60; 
  
        System.out.println(Math.sqrt(a)); 
  
        a = 90; 
  
        System.out.println(Math.sqrt(a)); 
    } 
}

Learn ReactJs, React Native from akashmittal.com