Menu
Question Index
...

What will be the output of following program?

class Scooter {

    public Scooter() {
    }
}

class Honda extends Scooter {

    public Honda() {
    }

    public void mileage() {
        System.out.println("Min: 30Km");
    }

    public void speed() {
        System.out.println("Max: 90Kmph");
    }
}

public class HondaShine extends Honda {

    public HondaShine() {
        System.out.println("Honda Model: Shine");
    }

    @Override
    public void speed() {
        System.out.println("Max: 80Kmph");
    }

    public static void main(String args[]) {
        HondaShine obj = new HondaShine();
        obj.mileage();
        obj.speed();
    }
}


Honda Model: Shine
Min: 30Km
Max: 90Kmph
Honda Model: Shine
Min: 30Km
Max: 80Kmph
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Multilevel Inheritance In Java With Example Program

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App