Question: Among object-oriented languages, one feature that varies considerably is whether the language allows multiple inheritance. C++ does but Java does not. Explain with code examples
Among object-oriented languages, one feature that varies considerably is whether the language allows multiple inheritance. C++ does but Java does not. Explain with code examples that you have written to demonstrate how Java accomplishes inheritance. In a way, this discussion is a continuation of the discussion board post from the previous week. Explain with the use of interface and super and subclass examples. One Java class can extend a superclass and also can implement an interface.
1. Write Java code with one interface and one method in that interface.
2. Write one Java class that is abstract with one method.
3. Write one Java class that extends from the abstract class and implements the interface. Just write System.out.println there. Write another Java class in a similar way that extends from the abstract class and implements the interface; and write some other System.out.println there. Write one Java class with main method and invoke these above 2 Java classes to display the result of System.out.println.
Finally, explain what your code does, and how multiple inheritance is exhibited in your code.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
