Java program to implement multiple-inheritance using the interface
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
In this program, we will create 2 Interfaces. Each interface contains an abstract method. Then we will implement created interface in a class.
Program/Source Code:
The source code to implement multiple-inheritance using the interface is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we created 2 interfaces Inf1, Inf2. Then we implemented the created interfaces in the Sample class to implement multiple-inheritance.
The Main class contains a method main(). The main() method is the entry point for the program, here we created the object of the Sample class. After that, we called methods and printed the result.