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()
    {
        super.story();
        System.out.println("With story");
    }
}
class Hero extends Director
{
    void story()
    {
        super.story();
        System.out.println("Good Movie");
    }    

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


Good Movie
With story
Good Movie
No story
With story
Good Movie
Compilation Error or Runtime Error

Doubts

Problems

Topic: Super Keyword In Java To Call Super Class Constructor

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App