class square
{
int l;
square()
{
System.out.println("inside constructor of square");
l=10;
}
void area()
{
System.out.println("area of square :"+(l*l));
}
}
class defaultconstructordemo1
{
public static void main(String args[])
{
square s = new square();
s.area();
}
}
=================================================
output :
inside constructor of square
area of square :100
{
int l;
square()
{
System.out.println("inside constructor of square");
l=10;
}
void area()
{
System.out.println("area of square :"+(l*l));
}
}
class defaultconstructordemo1
{
public static void main(String args[])
{
square s = new square();
s.area();
}
}
=================================================
output :
inside constructor of square
area of square :100