Menu
Question Index
...

What will be the output of following program?

class Producer
{
    void story()
    {
        System.out.println("No story");
    
    }
}    
class Director extends Producer
{
    void story()
    {
        System.out.println("With story");
    }
}
class Hero extends Director
{
    void story()
    {
        System.out.println("Good Movie");
    }    

}
public class Movie
{
    public static void main(String args[])
    {
        Hero hero = new Hero();
        hero.story();
    }
}


No story
Good Movie
Compilation Error
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