Java : Inheritance - Exercises and Solution


1. Write a Java program to Implement single inheritance

View Solution

2. Write a Java program to Implement multilevel inheritance

View Solution

3. Write a Java program to Implement hierarchical inheritance

View Solution

4. Write a Java program to Override a base class method into a derived class

View Solution

5. Write a Java program to Demonstrate the protected access specifier

View Solution

6. Write a Java program to Create an Student class by inheriting Person class

View Solution

7. Write a Java program to Call the method with the same name using super keyword

View Solution

8. Write a Java program to Call a superclass constructor from sub/child class

View Solution

9. Write a Java program to Method Overloading and Inheritance

View Solution

10. Write a Java program to Final Class and Inheritance

View Solution

11. Write a Java program to Static Methods and Inheritance

View Solution

12. Write a Java program to Multiple Inheritance using Interfaces

View Solution

13. Write a Java program to Method Overriding with Exception Handling

View Solution

14. Write a Java program to Accessing Superclass Members

View Solution

15. Write a Java program to Method Overriding with Covariant Return Types

View Solution

16. Write a Java program to Constructor Overriding and Superclass Initialization

View Solution

17. Write a Java program to demonstrates method overriding

View Solution

18. Write a Java program to demonstrates the use of the protected access specifier

View Solution

19. Write a Java program to demonstrates accessing superclass members using the super keyword

View Solution

20. Write a Java program to demonstrates the use of a final class in inheritance

View Solution

21. Write a Java program to demonstrates the use of abstract classes in inheritance

View Solution

22. Write a Java program to demonstrate the order of superclass and subclass initialization

View Solution

23. Write a Java program to demonstrate dynamic method dispatch

View Solution

24. Write a Java program to demonstrate interface inheritance

View Solution

25. Write a Java program to diamond problem in multiple inheritance

View Solution



Basic Programs