Write a Java Program to Implement multiple inheritance

Java Program to Implement multiple inheritance

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn Java programming concepts. You can learn Java  language at your own speed and time. One can learn concepts of Java language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Java Program to Implement multiple inheritance
Java Program to Implement multiple inheritance

Write a Java Program to Implement multiple inheritance

PROGRAM: Java Program to Implement multiple inheritance

/*Java Program to Implement multiple inheritance*/

interface Backend {

// abstract class
public void connectServer();
}

class Frontend {

public void responsive(String str) {
System.out.println(str + ” can also be used as frontend.”);
}
}

// Language extends Frontend class
// Language implements Backend interface
class Language extends Frontend implements Backend {

String language = “Java”;

// implement method of interface
public void connectServer() {
System.out.println(language + ” can be used as backend language.”);
}

public static void main(String[] args) {

// create object of Language class
Language java = new Language();

java.connectServer();

// call the inherited method of Frontend class
java.responsive(java.language);
}

}

Leave a Reply

Your email address will not be published. Required fields are marked *