Important Concepts Programming

Sqrt() Function In Java

Java is the most popular programming language available with a wide range of features, In java language sqrt() function is very useful for the mathematical operation in the program.

What is sqrt() function

  • sqrt() function in Java programming language is used to find the square root of any given number.
  • sqrt() function is predefined in the library.
  • sqrt() function is available in “math” class package.

How to use sqrt() function

  • Firstly, we need to declare the math class before the main function.
  • Now use the function followed by the syntax – sqrt(variable/number).
  • Finally, give the input to the function.

Example of sqrt() function

class test
 public static void main(string args[])
  int x;
  system.out.println("The square root of 9 is:"+x);


Important Reads

-> Variables in Java ( Easy Concept )

-> Type Conversion In Java (Super Easy)

-> Difference between C and Java (C vs Java)


Leave a Reply