Inheritance in java

Inheritance is a mechanism in which one object acquires all the properties and behaviors of parent object.
Benefits of inheritance

  • reuse of methods 
  • reuse of fields of parent class 
  • We can add new methods and fields
Syntax

  1. public class className extends ParentclassName  
  2. {  
  3.    //methods and fields  
  4. }  
Example:

Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept