double num = 25; double squareRoot = Math.sqrt(num); System.out.println("The square root of " + num + " is " + squareRoot);
double num = -3; double squareRoot = Math.sqrt(num); System.out.println("The square root of " + num + " is " + squareRoot);This will output "The square root of -3 is NaN". The Math.sqrt() function is a part of the java.lang package, which is automatically imported into every Java program.