Java does not support multiple inheritance through classes, but it allows a class to implement multiple interfaces. This enables a class to inherit multiple sets of behaviors or capabilities without the ambiguity problems associated with multiple class inheritance.
A SmartPhone can perform multiple roles. It can make calls and take photos. These capabilities can be defined through separate interfaces and implemented by a single class.
interface Camera {
void takePhoto();
}
interface Phone {
void makeCall();
}
class SmartPhone implements Camera, Phone {
@Override
public void takePhoto() {
System.out.println("Taking Photo");
}
@Override
public void makeCall() {
System.out.println("Making Call");
}
}
public class Demo {
public static void main(String[] args) {
SmartPhone phone = new SmartPhone();
phone.takePhoto();
phone.makeCall();
}
}Taking Photo
Making Call
Instead of inheriting from multiple classes, it can implement multiple interfaces such as Displayable, Connectable, and VoiceControlled.
A concise interview answer is
Java does not support multiple inheritance through classes, but a class can implement multiple interfaces. This allows the class to inherit multiple behaviors while avoiding ambiguity problems such as the Diamond Problem. For example, a SmartPhone can implement both Camera and Phone interfaces.
Last updated: 16 July 2026
Previous question: Can you provide examples of when to use an interface versus when to extend a class?
Next question: Can an interface in Java contain static methods, and if so, how can they be used?