Interview Question

Java Developer Interview Denver, CO

overriding vs. overloading, Interface vs. Abstract

  , .equals() vs. ==, static vs. final
Answer

Interview Answer

1 Answer

0

Overriding - two methods with the same name, but different input parameters
Overloading - child class has same signature (method name and parameters) as parent class; the parent method's functionality is overridden by the child method's.

Abstract methods do not have implementation, and should be implemented in child classes. All classes that implement an interface MUST override each method in the interface.

== compares references in memory (only use with simple structures like ints), .equals compares the values contained in the objects (use with Strings).

The static keyword is used to define constants, or methods that use no instance variables.
Final variables cannot change, final classes cannot be extended, and final methods cannot be overridden. Static methods are also final, but static variables can be changed; however, There Can Be Only One of a static variable throughout all instances of a class.

Interview Candidate on Jan 13, 2011

Add Answers or Comments

To comment on this Question, Sign In with Facebook or Sign Up