Menu
Question Index
...

What will be the output of the following program?

class OutPut
{
    public static void main(String [] args)
    {
        Count2 count = new Count2();
        count.count();
    }
}

class Count extends Count2
{
    Count()
    {

    }
}

class Count2
{
    void count()
    {
        System.out.print("Output = ");

        for (int count = 0; count <= 21; count += 5)
        {
            System.out.print(" " + count);
        }
    }
}


Output = 0 4 9 13 17 21
Output = 0 5 10 15 20
Output = 0 6 11 16 21
Compilation Error
Runtime Error

Doubts

Problems

Topic: Inheritance And Constructors 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