wood burning stoves 2.0*
The moose likes Java in General and the fly likes Inheritance Output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Inheritance Output" Watch "Inheritance Output" New topic
Author

Inheritance Output

amrut sabade
Ranch Hand

Joined: Aug 16, 2010
Posts: 90



and my testing class

i was expecting the out put as
in Employee class
in salesManager class
in Ceo constructor
but the out put is

in Employee class
in Employee class
in salesManager class
in Ceo constructor
why the constructor of employee is called twice
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4374
    
    8

Because you're creating two of them. One Employee on line 10, and one CEO on line 11 (which leads to the base-class constructors being called). Did you forget about the firsty one?
amrut sabade
Ranch Hand

Joined: Aug 16, 2010
Posts: 90
Ohhh ya extremely sorry i forgot about the frist line
thanku for your time.... i have just practising the inheritance...
i wanted to know that about the super keyword
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inheritance Output