
Classes and Objects • 201
d1 = new demo(“welcome”, 345);
d1.show();
}
}
OUTPUT:
Constructor with string argument
Constructor with string & int argument
Constructor with default argument
Str :=Default num :=235
Consturctor with int argument
Str :=null num :=20
Constructor with string argument
Str :=fun num :=0
Constructor with string argument
Constructor with string & int argument
Str :=welcome num :=345
Explanation: The line in bold shows that this can be used to call the constructor within the constructor with
arguments. Follow the program step by step and the output will be obtained as shown above.
7.11 GARBAGE COLLECTION ...