multiple inheritance in java
Multiple inheritance is achieved and
implemented using interfaces
multiple inheritance in java
Multiple inheritance is achieved and
implemented using interfaces
multilevel inheritance in java
class Car{
public Car()
{
System.out.println("Class Car");
}
public void vehicleType()
{
System.out.println("Vehicle Type: Car");
}
}
class Maruti extends Car{
public Maruti()
{
System.out.println("Class Maruti");
}
public void brand()
{
System.out.println("Brand: Maruti");
}
public void speed()
{
System.out.println("Max: 90Kmph");
}
}
public class Maruti800 extends Maruti{
public Maruti800()
{
System.out.println("Maruti Model: 800");
}
public void speed()
{
System.out.println("Max: 80Kmph");
}
public static void main(String args[])
{
Maruti800 obj=new Maruti800();
obj.vehicleType();
obj.brand();
obj.speed();
}
}
how u can achieve multiple inheritances
Multiple inheritance in Java programming is achieved or
implemented using interfaces. Java does not support multiple
inheritance using classes.
In simple term, a class can inherit only one class and multiple
interfaces in a java programs. In java terminology, we can say that
“A class can extend only one class but it can implement
multiple interfaces.”
how to achieve multiple inheritance in java
Multiple inheritance is achieved and
implemented using interfaces.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us