aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Constructor" Watch "Constructor" New topic
Author

Constructor

rex tony
Ranch Hand

Joined: Aug 29, 2007
Posts: 159
Good afternoon to all.

the answer is subclass! subclass!
How?
explain

[Jesper Young: Corrected code tags and indentation]
[ October 01, 2007: Message edited by: Jesper Young ]
Sheikh Sadiruddin
Greenhorn

Joined: Aug 10, 2007
Posts: 21
Hi rex tony,
You are overriding superclass,s method() in subclass.
so in runtime the subclass version of the method() runs.Hence the out put follows.


SCJP 6 (80%) || SCWCD 5 (92%)
Lucky J Verma
Ranch Hand

Joined: Apr 11, 2007
Posts: 277
Answer should be 1 time subclass! only.
NOt twice,or is it for you?
suresh mulagala
Ranch Hand

Joined: Feb 18, 2003
Posts: 41
when subclass is intantiated, superclass constructor is called which inturn calls the overridden method() and thus it prints

"subclass!" - superclass constructor
"subclass!" - subclass constructor
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Constructor
 
Similar Threads
this and super
Difference between override and hiding
question from Dan's exam - ClassCastException
Static Methods in an Interface
does class inherits the constructors of super class