Wednesday, 18 October 2017

Inheritance in java

Inheritance

"Inheritance is a process by which object of one class acquires the properties of the object of another class".

The Mechanism of deriving a new class from an old one is called inheritance.

Types Of Inheritance

 

1.single Inheritance

2.Multi-level Inheritance

3.Multiple Inheritance

4.Hierarchical  Inheritance

5.Hybrid  Inheritance    

1.single Inheritance:

Only one base class and only one derived class in a program are known as single inheritance.Types Of Inheritance   1.single Inheritance 2.Multi-level Inheritance 3.Multiple Inheritance 4.Hierarchical  Inheritance 5.Hybrid  Inheritancethejavaxpert blog, thejavaxpert.blogspot.com, Piyush Dabhi blog, Dabhi Piyush blog, TheJavaXpert blogger owner name,  Java all info, java master, java manual, java Expert, Java Best information, Java New blog, JAVA, Piyush, Dabhi, piyush blog, Pkdabhi,  Gurukul blog, BCA, BCA best knowledge, IT, IT knowledge,  language, OOP concept, Full OOP languages name, All java program, Core java, Core Java Interview, Java Knowledge, JAVA language, Full Object oriented languages, Java nice info, Java best knowledge, Java Master, Java  java,, My java, javazone, Java game programming, java programs, java GUI, Java Blog, Top 10 java blog, javaxpert is the best blog, Java new blog list,  java top 10 blog, java top website, java top web, java,Control statement,Java token,Pk dabhi,techno pk,JAVA hindi,java in gujrati, java in all language,java cool knowladge Java world, java info blog, java technology,J2ee,J2ee java,J2me,java 2 standard edition,Inheritance in java,Difference between Static And Non-Static MembersStatic Versus Non-Static Member,Constructor in JavaConstructor,Finalize() MethodFinalize() Method,The Basic Concept of OOP(Object Oriented Programming)Basic Concept of OOP ,How to get values from userCommand line argument,Array In JavaArray,Control StatementControl statement,Type Casting/ Type Conversion in JavaType casting ,java OpearatorsJava Basic perators, Operators of Java,Java TokenJava Token, Java Tokens,Data TypeDatatype,How to set path in Java?SetPath In Java ,Compiling And Executing Basic Java ProgramExecutin Basic Java Program,What Is JavaWhat is java?,JVM, JRE, Difference between JVM and JREJVM ,Discussion of JDK(Java Development Kit)JDK,C++ V/S JavaCPP v/s Java,Features/Advantages Of JavaFeatures of Java ,History Of JavaHistory of Java

 

2.Multi-level Inheritance:

One class inherit into second class and second class inherits into a third class is known as multi-inheritance.




Types Of Inheritance   1.single Inheritance 2.Multi-level Inheritance 3.Multiple Inheritance 4.Hierarchical  Inheritance 5.Hybrid  Inheritance

 

3.Mult Inheritance:

Multiple inheritances do not support in java.

It is not possible in java

Types Of Inheritance   1.single Inheritance 2.Multi-level Inheritance 3.Multiple Inheritance 4.Hierarchical  Inheritance 5.Hybrid  Inheritance,thejavaxpert blog, thejavaxpert.blogspot.com, Piyush Dabhi blog, Dabhi Piyush blog, TheJavaXpert blogger owner name,  Java all info, java master, java manual, java Expert, Java Best information, Java New blog, JAVA, Piyush, Dabhi, piyush blog, Pkdabhi,  Gurukul blog, BCA, BCA best knowledge, IT, IT knowledge,  language, OOP concept, Full OOP languages name, All java program, Core java, Core Java Interview, Java Knowledge, JAVA language, Full Object oriented languages, Java nice info, Java best knowledge, Java Master, Java  java,, My java, javazone, Java game programming, java programs, java GUI, Java Blog, Top 10 java blog, javaxpert is the best blog, Java new blog list,  java top 10 blog, java top website, java top web, java,Control statement,Java token,Pk dabhi,techno pk,JAVA hindi,java in gujrati, java in all language,java cool knowladge Java world, java info blog, java technology,J2ee,J2ee java,J2me,java 2 standard edition,Inheritance in java,Difference between Static And Non-Static MembersStatic Versus Non-Static Member,Constructor in JavaConstructor,Finalize() MethodFinalize() Method,The Basic Concept of OOP(Object Oriented Programming)Basic Concept of OOP ,How to get values from userCommand line argument,Array In JavaArray,Control StatementControl statement,Type Casting/ Type Conversion in JavaType casting ,java OpearatorsJava Basic perators, Operators of Java,Java TokenJava Token, Java Tokens,Data TypeDatatype,How to set path in Java?SetPath In Java ,Compiling And Executing Basic Java ProgramExecutin Basic Java Program,What Is JavaWhat is java?,JVM, JRE, Difference between JVM and JREJVM ,Discussion of JDK(Java Development Kit)JDK,C++ V/S JavaCPP v/s Java,Features/Advantages Of JavaFeatures of Java ,History Of JavaHistory of Java

 

4.Hierarchical  Inheritance:

More than one class derived from one based class is called hierarchical inheritance.

 
1.single Inheritance 2.Multi-level Inheritance 3.Multiple Inheritance 4.Hierarchical  Inheritance 5.Hybrid  Inheritance              1.single Inheritance:thejavaxpert blog, thejavaxpert.blogspot.com, Piyush Dabhi blog, Dabhi Piyush blog, TheJavaXpert blogger owner name,  Java all info, java master, java manual, java Expert, Java Best information, Java New blog, JAVA, Piyush, Dabhi, piyush blog, Pkdabhi,  Gurukul blog, BCA, BCA best knowledge, IT, IT knowledge,  language, OOP concept, Full OOP languages name, All java program, Core java, Core Java Interview, Java Knowledge, JAVA language, Full Object oriented languages, Java nice info, Java best knowledge, Java Master, Java  java,, My java, javazone, Java game programming, java programs, java GUI, Java Blog, Top 10 java blog, javaxpert is the best blog, Java new blog list,  java top 10 blog, java top website, java top web, java,Control statement,Java token,Pk dabhi,techno pk,JAVA hindi,java in gujrati, java in all language,java cool knowladge Java world, java info blog, java technology,J2ee,J2ee java,J2me,java 2 standard edition,Inheritance in java,Difference between Static And Non-Static MembersStatic Versus Non-Static Member,Constructor in JavaConstructor,Finalize() MethodFinalize() Method,The Basic Concept of OOP(Object Oriented Programming)Basic Concept of OOP ,How to get values from userCommand line argument,Array In JavaArray,Control StatementControl statement,Type Casting/ Type Conversion in JavaType casting ,java OpearatorsJava Basic perators, Operators of Java,Java TokenJava Token, Java Tokens,Data TypeDatatype,How to set path in Java?SetPath In Java ,Compiling And Executing Basic Java ProgramExecutin Basic Java Program,What Is JavaWhat is java?,JVM, JRE, Difference between JVM and JREJVM ,Discussion of JDK(Java Development Kit)JDK,C++ V/S JavaCPP v/s Java,Features/Advantages Of JavaFeatures of Java ,History Of JavaHistory of Java

5.Hybrid  Inheritance:

Hybrid  Inheritance does not support in java
It is also not possible in java.

thejavaxpert blog, thejavaxpert.blogspot.com, Piyush Dabhi blog, Dabhi Piyush blog, TheJavaXpert blogger owner name,  Java all info, java master, java manual, java Expert, Java Best information, Java New blog, JAVA, Piyush, Dabhi, piyush blog, Pkdabhi,  Gurukul blog, BCA, BCA best knowledge, IT, IT knowledge,  language, OOP concept, Full OOP languages name, All java program, Core java, Core Java Interview, Java Knowledge, JAVA language, Full Object oriented languages, Java nice info, Java best knowledge, Java Master, Java  java,, My java, javazone, Java game programming, java programs, java GUI, Java Blog, Top 10 java blog, javaxpert is the best blog, Java new blog list,  java top 10 blog, java top website, java top web, java,Control statement,Java token,Pk dabhi,techno pk,JAVA hindi,java in gujrati, java in all language,java cool knowladge Java world, java info blog, java technology,J2ee,J2ee java,J2me,java 2 standard edition,Inheritance in java,Difference between Static And Non-Static MembersStatic Versus Non-Static Member,Constructor in JavaConstructor,Finalize() MethodFinalize() Method,The Basic Concept of OOP(Object Oriented Programming)Basic Concept of OOP ,How to get values from userCommand line argument,Array In JavaArray,Control StatementControl statement,Type Casting/ Type Conversion in JavaType casting ,java OpearatorsJava Basic perators, Operators of Java,Java TokenJava Token, Java Tokens,Data TypeDatatype,How to set path in Java?SetPath In Java ,Compiling And Executing Basic Java ProgramExecutin Basic Java Program,What Is JavaWhat is java?,JVM, JRE, Difference between JVM and JREJVM ,Discussion of JDK(Java Development Kit)JDK,C++ V/S JavaCPP v/s Java,Features/Advantages Of JavaFeatures of Java ,History Of JavaHistory of Java

 

-------------------------------------------------------------------------------------------------------

→"extends" is the keyword used to inherit the properties of a class. Following is the syntax of extends keyword.

→ Inheritance in java is a mechanism in which one object acquires all the properties and behavior of parent class.

→ We can inherit class using "extends" keyword.

Syntax


class Super
 {
   .....
   .....
}
class Sub extends Super {
   .....
   .....
}

Why use inheritance in java


  • For Method Overriding so, runtime polymorphism can be achieved.
  • For Code Reusability.

 

 

 

                      


Popular posts