Menu
Question Index
...

What will be the output of the following program?

class Merit
{
    Merit()
    {
        System.out.print(" Merit");
    }
    
    class Campus
    {
        Campus()
        {
            System.out.print("Campus");
        }

        public void go()
        {
            System.out.print(" To Become JAVA Programmer");
        }
    }

    public static void main (String [] args)
    {
        Merit m = new Merit();
        m.makeProgrammer();
    }

    void makeProgrammer()
    {
        (new Campus() {}).go();
    }
}


MeritCampus
To Become JAVA Programmer
To Become JAVA Programmer MeritCampus
MeritCampus To Become JAVA Programmer
Compilation Error

Doubts

Problems

Topic: Advanced Java Programming Concepts

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App