Java interview question

450 查看

  1. what is the difference between overriding and overloading?

Overriding is resolved at runtime while overloading is compile time.

Override: is a language feature that allows a subclass to provide a specific implementation of a method. The overriding method in subclass has same name, same parameters and same return type as the method in the parent class. static, private and final methods are not overridden in Java.

Overload: if you have two methods with same name in one class with different method signature like different number of parameters, type of argument(return type is not part of method signature)

  1. Difference between HashMap and Hashtable?