This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Overriding and Overloading. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Overriding and Overloading." Watch "Overriding and Overloading." New topic
Author

Overriding and Overloading.

Rohit Ramachandran
Ranch Hand

Joined: Oct 05, 2010
Posts: 102


I was under the impression that the output would give "Super Super" since for Overriding it's the type of the reference variable that counts.

However, the output I'm getting is 0.0 and 9.0
Rohit Ramachandran
Ranch Hand

Joined: Oct 05, 2010
Posts: 102
Is it the object type or reference type that determine which method is to be called in-
1)Overriding?
2)Overloading?

Thank you.
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 438

Reference type determines which overloaded method to be called at compile time
Object type determines which overriding method to be called at run time


SCJP 6 [86%] June 30th, 2010
OCPWCD [84%] March 26th, 2013
If you find any post useful, click the "plus one" sign on the right
Rohit Ramachandran
Ranch Hand

Joined: Oct 05, 2010
Posts: 102
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Overriding and Overloading.
 
Similar Threads
Super ()
Overriding and Overloading
try/catch with exception casting
a beginner wanna knows something about this( )
super(x,y) and this() in one constructor