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

Java Vehicle and Aeroplane Classes

The document contains a Java code snippet defining a class hierarchy with a Vehicle class, Movable and Flyable interfaces, and an Aeroplane class that extends Vehicle and implements both interfaces. The Aeroplane class provides specific implementations for the move and fly methods. The Main class demonstrates the creation of an Aeroplane object and calls its methods to display its type, movement, and flying capabilities.

Uploaded by

Omkar Saste
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)
21 views2 pages

Java Vehicle and Aeroplane Classes

The document contains a Java code snippet defining a class hierarchy with a Vehicle class, Movable and Flyable interfaces, and an Aeroplane class that extends Vehicle and implements both interfaces. The Aeroplane class provides specific implementations for the move and fly methods. The Main class demonstrates the creation of an Aeroplane object and calls its methods to display its type, movement, and flying capabilities.

Uploaded by

Omkar Saste
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

class Vehicle {

void displayType() {

[Link]("This is a vehicle");

interface Movable {

void move();

interface Flyable {

void fly();

class Aeroplane extends Vehicle implements Movable, Flyable {

@Override

public void move() {

[Link]("Aeroplane moves on runway before takeoff");

@Override

public void fly() {

[Link]("Aeroplane flies in the sky");

}
public class Main {

public sta c void main(String[] args) {

Aeroplane plane = new Aeroplane();

[Link]();

[Link]();

plane.fly();

You might also like