Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

overriding

 
srinivas sridaragaddi
Ranch Hand
Posts: 225
  • 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
Posts: 15203
36
Android IntelliJ IDE Java Scala Spring
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic