Java overloading and overriding

Ask a question
          

Java overloading and overriding


<<Previous  Next>>

Java overloading and overriding interview questions

What is inheritance? Explain it with an example.

Through inheritance, classes can inherit commonly used state and behavior from their parent class. One class can have a single parent class and a class can have unlimited number of subclasses..............
Read answer

What is an overloaded method? Provide an example to explain it.

Overloaded methods are the methods which have the same name but different signatures..................
Read answer

Define overriding. Explain it with an example.

Overriding is done in a child class for a method that is written in the parent class. To override a method a new method is defined in the child class with exactly the same signature............
Read answer

Explain the difference between overloading and overriding.

Overloading and overriding are different aspects of polymorphism.
Overloading is also called static/early binding polymorphism..............
Read answer

Explain the use of ‘super’ keyword by giving an example.

super() / super(parameters) invokes the respective constructor or a method from the super class................
Read answer

Define a final class in java. Explain the purpose of final class.

A class declared as final cannot be extended further by any other class. The best example of such a class is the String class................
Read answer

<<Previous  Next>>



Write your comment - Share Knowledge and Experience


 

 
Interview questions
 
Home | Login | About us | Sitemap | Contact us