Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (120 points)
public class Testprogram{

public class Vehicle{

    String Vehicle_Type;

    String Colour;

    Number Vehicle_Number;

    

    Vehicle(String Vehicle_Type,String Colour,Number Vehicle_Number)

    {

        

    this.Vehicle_Type=Vehicle_Type;

    this.Colour=Colour;

    this.Vehicle_Number=Vehicle_Number;

        

    }

    

}

public class Car extends Vehicle{

    

    String Car_Brand;

    

     Car(String Car_Brand,String Vehicle_Type,String Colour,Number Vehicle_Number)

    {

        

        super(Vehicle_Type,Colour,Vehicle_Number);

        this.Car_Brand=Car_Brand;

        

    }

    

}

public class Auto extends Vehicle

{

    String Auto_Brand;

     Auto(String Auto_Brand,String Vehicle_Type,String Colour,Number Vehicle_Number)

    {

        super(Vehicle_Type,Colour,Vehicle_Number);

       this.Auto_Brand=Auto_Brand;

    }

}

   

     public static void main(String []args){

         Testprogram t=new Testprogram();

        System.out.println("Hello World");

        

        Car Xylo=new Car("Xylo","Automobile","Blue",51234);

        

     }

}

Please log in or register to answer this question.

Browse Categories

...