File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

overriding

 
srinivas sridaragaddi
Ranch Hand
Posts: 225
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


options:


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




output:AAA
but i was expecting it be CCC
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic