Calculate area of rectangle using default constructor in java
import java.util.*;
class RectangleShape
{
int area, length, breadth;
RectangleShape()
{
length = 50;
breadth = 20;
}
void getArea()
{
area = length * breadth;
System.out.println("Area of Rectangle : " + area);
}
}
public class RectangleAreaConstructor
{
public static void main(String[] args)
{
RectangleShape rs = new RectangleShape();
rs.getArea();
}
}