In our previous post we learned how to create classes and objects by using code example. In this post we will learn inheritance which is another important object oriented programming (OOP) concept. Inheritance in Java is like a parent child relationship. As child inherit some properties or behaviors from parents, similarly in inheritance (OOP Concept) a child class can inherit properties and methods from parent class. Following simple code example explains the inheritance concepts in Java programming. This code consists of 3 Java classes, main class (LearningInheritance.java), parent class (Vehicle.java) and child class (Car.java). Create a new project in netbeans (java...
forward
Recent Comments
Archives
- November 2024
- July 2021
- December 2020
- November 2020
- September 2020
- August 2020
- July 2020
- April 2020
- March 2020
- February 2020
- January 2020
- December 2019
- October 2019
- April 2018
- March 2018
- February 2018
- January 2018
- December 2017
- November 2017
- March 2017
- January 2017
- December 2016
- November 2016
- October 2016
- June 2015
- May 2015
- April 2015