1class Car{
2 public Car()
3 {
4 System.out.println("Class Car");
5 }
6 public void vehicleType()
7 {
8 System.out.println("Vehicle Type: Car");
9 }
10}
11class Maruti extends Car{
12 public Maruti()
13 {
14 System.out.println("Class Maruti");
15 }
16 public void brand()
17 {
18 System.out.println("Brand: Maruti");
19 }
20 public void speed()
21 {
22 System.out.println("Max: 90Kmph");
23 }
24}
25public class Maruti800 extends Maruti{
26
27 public Maruti800()
28 {
29 System.out.println("Maruti Model: 800");
30 }
31 public void speed()
32 {
33 System.out.println("Max: 80Kmph");
34 }
35 public static void main(String args[])
36 {
37 Maruti800 obj=new Maruti800();
38 obj.vehicleType();
39 obj.brand();
40 obj.speed();
41 }
42}
1Multiple inheritance in Java programming is achieved or
2implemented using interfaces. Java does not support multiple
3inheritance using classes.
4In simple term, a class can inherit only one class and multiple
5interfaces in a java programs. In java terminology, we can say that
6
7“A class can extend only one class but it can implement
8multiple interfaces.”