Menu
Question Index
...

What will be the output of the following program?

class OutPut
{
    public static void main(String s[])
    {
        int i = 2;
        B b = new B();
        b.execute();
    }
}

class A
{
    int i = 0;
}

class B extends A
{
    void execute()
    {
        System.out.println("i = " + i);
    }    
}


i = 2
i = 0
Compilation Error
Runtime Error

Doubts

Problems

Topic: Is-A Relationship In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App