Java Language Interview Question and Answers
41. |
What is the difference between method overriding and overloading? |
|
Overriding is a method with the same name and arguments as in a parent, whereas overloading is the same method name but different arguments. |
|
|
42. |
What do you mean by polymorphism? |
|
Polymorphism means the ability to take more than one form. fro example, an operation may exhibit behaviour in different instances. The behaviour depends upon the types of data used in the operatiom. |
|
|
43 |
What is the difference between an abstract class and an interface? |
|
Abstract class Interface - Have executable methods and abstract methods.Can only subclass one abstract class Interface - Have no implementation code. All methods are abstract.A class can implement any number of interfaces. |
|
|
44. |
What is the purpose of finalization? |
|
The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected. |
|
|
45. |
What is the difference between a break statement and a continue statement? |
|
Break statement results in the termination of the statement to which it applies (switch, for, do, or while). A Continue statement is used to end the current loop iteration and return control to the loop statement. |
|
|
123456789101112
Page 9 of 12