REGISTER FREE to Receive Instant Job

Sunday, 23 November 2014

Association,Is A Relation and Inheritance in Java

Association : - When two classes are related in some way they are said to be associated. Relation between classes of two types:-

  1. Is – A Relation
  2. Has – A Relation

Is – A Relation between classes is implemented with the help of inheritance.
Question: What is Inheritance?
Inheritance is the process of extending the functionality of a class by defining a new class which inherits all the features of the existing class and adds some features of its own. Inheritance is a means of implementing generalization.
Question: Why Inheritance is used?
 Inheritance is used for code Reusability and runtime polymorphism.
extends - In java ‘extends’ keyword is used to inherit the features of one class into another.
this(arguments if any)
Syntax :-
class Identifier extends BaseClassName
Additional methods
Additional dataMembers & methods

  1. Constructor of a class is never inherited in another class.
  2. Inheritance is always unidirectional i.e. child class knows everything of parent class but the reverse is not true.

1 comment:

Popular Posts

Powered by Blogger.

About Me

My photo

JobsAcid is a 'job search engine' to provide finding a job on the internet easier for the user. It has designed as huge selection of job offerings on the same search engine.