Monday, 18 March 2013

What is difference between overloading and overriding?


What is difference between overloading and overriding?  
a) In overloading, there is a relationship between methods available in the same class whereas in overriding, there is relationship between a superclass method and subclass method. b) Overloading does not block inheritance from the superclass whereas overriding blocks inheritance from the superclass. c) In overloading, separate methods share the same name whereas in overriding, subclass method replaces the superclass. d) Overloading must have different method signatures whereas overriding must have same signature.

Blog Author: Vijay Kumar


What is meant by Inheritance and what are its advantages?



What is meant by Inheritance and what are its advantages?  
Inheritance is the process of inheriting all the features from a class. The advantages of inheritance are reusability of code and accessibility of variables and methods of the super class by subclasses.


Blog Author: Vijay Kumar

What is the difference between this() and super()?


What is the difference between this() and super()?  
this() can be used to invoke a constructor of the same class whereas super() can be used to invoke a super class constructor.

Blog Author: Vijay Kumar


What is the difference between super class and subclass?


What is the difference between super class and subclass?
A super class is a class that is inherited whereas sub class is a class that does the inheriting.

Blog Author: Vijay Kumar


What modifiers may be used with top-level class?


What modifiers may be used with top-level class? 
public, abstract and final can be used for top-level class.

Blog Author: Vijay Kumar