aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How many objects are created ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How many objects are created ?" Watch "How many objects are created ?" New topic
Author

How many objects are created ?

al nik
Ranch Hand

Joined: Oct 18, 2007
Posts: 60
abstract class AbstractClass {}
interface MyInterface { }
class Parent extends AbstractClass implements MyInterface { }
class Child extends Parent {}


How many objects are created when I call
Child child = new Child();



SCJP5 - SCWCD5 - SCBCD5
Kishore Kumar
Ranch Hand

Joined: Oct 15, 2007
Posts: 71
Only two objects are created. One is Parent object and another is Child object.
David Coppens
Greenhorn

Joined: Oct 24, 2007
Posts: 17
Are you sure? I think you only create 1 object here.
Can anybody please confirm the answer given above?


SCJA (94%)<br />SCJP (84%)<br />SCWCD (84%)
ahmed yehia
Ranch Hand

Joined: Apr 22, 2006
Posts: 424
Creating an object of a class causes it's super class Constructor to be invoked but that doesn't create extra object.
al nik
Ranch Hand

Joined: Oct 18, 2007
Posts: 60
Creating an object of a class causes it's super class Constructor to be invoked but that doesn't create extra object.


OK! This's what I thought! Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How many objects are created ?