This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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.