my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes overriding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "overriding" Watch "overriding" New topic
Author

overriding

srinivas sridaragaddi
Ranch Hand

Joined: Jul 24, 2007
Posts: 225


options:


prints:AAA
prints:ABC
prints:CCC
compile time error
run time error




output:AAA
but i was expecting it be CCC


SCJP 5.0<br /> <br />"Skills are started with learning and mastered with improvement. Nothing is hereditary except death" BUDDHA...
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14279
    
  21

The method m1 in class B does not override the method m1 in class A, and the method m1 in class C does not override the method m1 in classes A and / or B.

Because the types of the arguments are different in the three m1 methods, these are not overridden methods, so method call polymorphism does not apply here.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: overriding