some tricky but fundmental interview questions (Java)

1. checked vs unchecked exceptions

what are the difference?
first, checked exceptions are checked by compiler at compiling time. So programmers are compulsory to handle them; while unchecked exceptions are NOT, and they are reported at runtime. There is actually no way or too expensive to check them at compile time, like array out of bound exception, negative array index, or something very serious, and not remediable.

2. are all methods of parent class inherited?

NO, constructors are of exceptions. They can not be inherited.

3. what is HashCode()?

HashCode() returns the memory address of the owner class. And, Equals() without overriding compares memory address of the two classes.

4.When To Use Interfaces
An interface allows somebody to start from scratch to implement your interface or implement your interface in some other code whose original or primary purpose was quite different from your interface. To them, your interface is only incidental, something that have to add on to the their code to be able to use your package.
When To Use Abstract classes

An abstract class, in contrast, provides more structure. It usually defines some default implementations and provides some tools useful for a full implementation. The catch is, code using it must use your class as the base. That may be highly inconvenient if the other programmers wanting to use your package have already developed their own class hierarchy independently. In Java, a class can inherit from only one base class.