II B.Tech II Sem CSE Java Lab Exercise - 5b (Inheritance)

b)Multi level Inheritance

Aim: To write a JAVA program to implement multi level Inheritance

Description:


Program:

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();
   }
}

Output:

No comments

File Uploading in PHP

  File Uploading in PHP PHP allow you to upload any type of a file i.e. image, binary or text files.etc..,PHP has one in built global variab...