Menu
Question Index
...

What will be the output of the following program?

class MotherBoard
{
    protected MotherBoard()
    {
        System.out.print(" MotherBoard ");
    }
}

public class CPU extends MotherBoard
{
    private CPU()
    {
        System.out.print(" Inside CPU ");
    }

    public static void main(String args[])
    {
        new CPU();
    }
}


MotherBoard
MotherBoard  Inside CPU
Inside CPU
Inside CPU  MotherBoard
Compilation 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