Posts

Showing posts with the label Java




Explain Different Types of Inheritance in Java

Image
Only one class is derived from the parent. Single Inheritance In single inheritance a single subclass extends from a single superclass. Types Of Inheritance In Java Single Vs Multiple Inheritance In simple words more than one child class extends a single parent class or a single parent class has more than one child class. . With inheritance we can reuse the fields and methods of the existing class. Systemoutprintln Bonus of Programmer. In Java there are several inheritance types such as single multilevel and hierarchical that can be used based on different circumstances. Rather we use interfaces to implement multiple inheritances in Java. Class Programmer extends Employee. If a class extends another class ie. In the image below class A serves as a base class for the derived class B. Unlike some other programming languages like C Java doesnt support the concept of multiple Inheritance to avoid ambiguity. Di...