Decode School

Free Certification Courses from

Java Program to find area of Square

Get side of square and find area of square

Sample Input 1:


Sample Output 1:


Program or Solution

import java.util.*;
class Rectangle
       public static void main(String args[])
            int side,area;
            Scanner sc=new Scanner(;
            System.out.println("Get side of square and find area of square");
            System.out.println("Enter The Input 1:");
            System.out.println("The Output 1 Is:\n"+area);




Program Explanation

Get side of a square (using scanner class) Calculate area by multiplying side and side(area = side * side) print area(using System.out.println())