Java Overriding and Overloading

Interface have default method

If subclass has override method, will implement override method, instead of overload method

如果实例的静态类型(compile-time type)为 superclass,动态类型(run-time type)为 subclass,调用方法时会调用 subclass 中 override 的方法,否则调用 default 方法,不会调用 overload 的方法

EX:

@override public void makeNoice(Animal al)

@overload public void makeNoice(Dog al)

Contents