• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is Method overloading is also known as static polymorphism?  RSS feed

 
yeshvanth kannan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam just newbie to java
In the below code I have oveloaded print method between two different classes

Based on object at runtime only corresponding print method will be executed.If my understanding is right then how can we say method overloading is considered to be static ploymorphism

[Added code tags - see UseCodeTags for details]
Please clarify me.Thanks in advance

 
Tapas Chand
Ranch Hand
Posts: 614
9
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is called method overriding, not method overloading.
 
Campbell Ritchie
Marshal
Posts: 56533
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

That isn't overriding because the parameters are different types.
Yes, people do say static polymorphism, but people use even more inaccurate and worse terms than that. Restrict the word polymorphism to mean overriding.
 
Knute Snortum
Sheriff
Posts: 4274
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It isn't germane to you question, but in both classes, this.arg is not being used. Only the arg parameter is.
 
Tapas Chand
Ranch Hand
Posts: 614
9
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops, my mistake...did not see the argument type.
sorry for misleading.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!