overloading and overriding

What is the difference between method overloading and method overriding in Java?

Differences between method overloading and overriding are:

  • Method overloading is static polymorphism. Method overriding is runtime polymorphism.
  • Method overloading occurs within the same class. Method overriding happens in two classes with hierarchy relationship.
  • Parameters must be different in method overloading. Parameters must be same in method overriding.
  • Method overloading is a compile time concept. Method overriding is a runtime concept.
posted @ 2019-04-03 13:39  kissrule  阅读(229)  评论(0编辑  收藏  举报