{
int height;
int width;
Square(int height, int width)
{
// Note that constructor variable and instance variable names are same
this.height = height;
this.width = width;
}
}
class ImplSquare
{
public static void main(String args[])
{
Square sObj1 = new Square(2,3);
System.out.println("Variable values of object : ");
System.out.println("Object height = " + sObj1.height);
System.out.println("Object width = " + sObj1.width);
}
}
Output
Variable values of object :
Object height = 0
Object width = 0