15 posts
If a class implements multiple interfaces, or an interface extends multiple interfaces, it is known as multiple inheritance.
//Print.java
interface Prints
{
void print();
}
//Show.java
interface Shows
{
void show();
}
//Main.java
class Main implements Prints,Shows
{
public void print()
{
System.out.println("Hello");
}
public void show()
{
System.out.println("Welcome");
}
public static void main(String args[])
{
Main obj = new Main();
obj.print();
obj.show();
}
}
Please log in to leave a comment.