class DefaultCon
{
int length = 25;
int width = 20;
DefaultCon()
{
System.out.println("Area of rectangle: "+(length*width));
}
public static void main(String args[])
{
DefaultCon emp = new DefaultCon();
}
}
class Rectangle
{
int length;
int width;
Rectangle (int a, int b)
{
length = a ;
width = b ;
}
int calculateArea()
{
return(length*width);
}
public static void main(String args[])
{
Rectangle rec = new Rectangle (25, 15);
long area = rec.calculateArea();
System.out.println("Area of Rectangle: "+area);
}
}
class Employee
{
String name;
int age;
String company;
Employee (String a, int b)
{
name = a ;
age = b ;
}
Employee (String a, int b, String c)
{
name = a ;
age = b ;
company = c;
}
Employee (String a, String b)
{
name = a ;
company = b ;
}
void display()
{
System.out.println(name+" "+age+" "+company);
}
public static void main(String args[])
{
System.out.println("Name Age Company");
Employee emp1 = new Employee("ABC", 23);
Employee emp2 = new Employee("XYZ",30,"TutorialRide.com");
Employee emp3 = new Employee("PQR", "CareerRide Info");
emp1.display();
emp2.display();
emp3.display();
}
}