in this tutorial, you can learn how to get the square root of a number in Java.

Make the object of Scanner class then take input from the keyboard, simply use math class and get a square of a number in Java


package javaapplication;

import java.util.Scanner;

public class JavaApplication {

    public static void main(String[] args) {

        Scanner sc = new Scanner(;

        System.out.print("Enter an integer number: ");
        int num = sc.nextInt();

        System.out.println("Square Root of " + num + " is: " + Math.sqrt(num));





Enter an integer number: 144

Square Root of 144 is: 12.0