Class A { public void methodA() { System.out.println("Base class method"); } } Class B extends A { public void methodB() { System.out.println("Child class method"); } public static void main(String args[]) { B obj = new B(); obj.methodA(); //calling super class method obj.methodB(); //calling local method } }
Single inheritance is damn easy to understand. When a class extends another one class only then we call it a single inheritance. The below flow diagram shows that class B extends only one class which is A. Here A is a parent class of B and B would be a child class of A.
More
Search
Online Exam-Quiz
Recent Posts
- Java Online Exam-Quiz1
- What is java
- How Does Blockchain Technology Work?
- BlockChain Technology
- Online Quiz-Exam
- SDLC
- Web Hosting ?
- What is a domain name?
- Introduction to C Programming
- Inheritance in Java
- Features – JAVA
- How To Write & Compile C++ Program – Linux
- What does Programming mean?
- What is Software ?