public class Rectangle
{
int length, width;
Rectangle(int length, int width)
{
this.length = length;
this.width = width;
}
int areaCal()
{
return (length*width);
}
public static void main(String args[])
{
Rectangle rec = new Rectangle(53, 45);
int area = rec.areaCal();
System.out.println ("Area of Rectangle: "+area);
}
}
class ConDemo
{
int empId;
String name;
ConDemo()
{
System.out.println("Default Constructor:");
}
ConDemo(int empId, String name)
{
this(); // invoked default constructor
this.empId = empId;
this.name = name;
}
void show()
{
System.out.println("Employee ID: "+empId+" Name: "+name);
}
public static void main(String args[])
{
ConDemo con = new ConDemo(100,"XYZ");
con.show();
}
}