File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
a beginner wanna knows something about this( )
super(x,y) and this() in one constructor
Super ()
Overriding and Overloading
try/catch with exception casting