Overriding and Overloading in Java

Override (override):
Occurs between the subclass and the superclass: the number of methods with the
same method name , the same type, and the return value type is less than or equal to the return value type of the superclass

Overloading:
Occurs in a class: the number of methods with the
same method name , different types, and the return value types can be the same or different

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325511372&siteId=291194637