0% found this document useful (0 votes)
11 views2 pages

Java Exp 4

The document contains a Java program that defines a class hierarchy for a car, including classes for Engine, Tyre, and Door. The main method creates an instance of the Door class and displays the car's average speed, tyre warranty, and number of doors. The program demonstrates basic object-oriented programming concepts such as inheritance and method overriding.

Uploaded by

tp60120
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Java Exp 4

The document contains a Java program that defines a class hierarchy for a car, including classes for Engine, Tyre, and Door. The main method creates an instance of the Door class and displays the car's average speed, tyre warranty, and number of doors. The program demonstrates basic object-oriented programming concepts such as inheritance and method overriding.

Uploaded by

tp60120
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Name Tejas Tanaji Patil

Roll No- 3081

Div -‘ B ’

import [Link];

class Engine {

Scanner sc = new Scanner([Link]);

void Display_Car(int Speed, int avg) {

[Link]("The Avg Of The Car Is :" + Speed + " km/hr");

[Link]("The Spped Of The Car Is : " + avg + " km/ltr");

class tyre extends Engine {

void Display_Tyre(int warannty, String Company) {

[Link]("Warannty of tyre is " + warannty + " YRS , And The Company IS :" +
Company);

class Door extends tyre {

void Display_Door(int no) {


[Link]("No of Door Is :" + no);

public class car {

public static void main(String args[]) {

Door d1 = new Door();

d1.Display_Car(90, 79);

d1.Display_Tyre(10, "MRF");

d1.Display_Door(4);

OUTPUT

You might also like