What is Inheritance in Java and OOPS Tutorial - Example
Inheritance in Java is an Object oriented or OOPS concepts, which allows to emulate real world Inheritance behavior, Inheritance allows code reuse in Object oriented programming language e.g. Java. Along with Abstraction, Polymorphismand Encapsulation, Inheritance forms basis of Object oriented programming. Inheritance is implemented using extends keyword in Java and When one Class extends another Class it inherit all non private members including fields and methods. Inheritance in Java can be best understand in terms of Parent and Child class, also known as Super class and Sub class in Java programming language. The classwhich extends another class becomes Child of the class it extends and inherit all its functionality which is not private or package-private given where Child class is created. Inheritance is the most easy way to reuse already written and tested code but not always best way to do so, which we will see in this article. There are lot of example of Inheritance in Object oriented world e.g. Child inherit properties from parent, Dog inherit properties of Animal etc. In this Java and OOPS tutorial we will learn What is Inheritance in Java, How to use Inheritance in Java, Simple Example of Java Inheritance and some important points about Inheritance in Java.
Comments
Post a Comment
-Berkomentarlah yang baik dan rapi.
-Menggunakan link aktif akan dihapus.