Java program to calculate area of Square

/**
 * @author: BeginnersBook.com
 * @description: Program to Calculate Area of square.Program 
 * will prompt user for entering the side of the square.
 */
import java.util.Scanner;
class SquareAreaDemo {
   public static void main (String[] args)
   {
       System.out.println("Enter Side of Square:");
       //Capture the user's input
       Scanner scanner = new Scanner(System.in);
       //Storing the captured value in a variable
       double side = scanner.nextDouble();
       //Area of Square = side*side
       double area = side*side; 
       System.out.println("Area of Square is: "+area);
   }
}


Learn More :