Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

method overriding

 
maggie karve
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why is superclass method called???
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because you're not overriding the method get and you're using a reference of type SuperCafe4Java.

Don't forget to Quote Your Sources
 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is method overloading.
 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


try @Override, it confirms if it is overriding or not.

 
Minhaj Mehmood
Ranch Hand
Posts: 400
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maggie joseph wrote:why is superclass method called???


because you are not overriding the method, you are overloading it.
remember the rule of overriding the number of parameter(s) and the type of parameter(s) must be same where the return type can be co-variant of an overridden method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic