Menu
Topics Index
...
`

Classes855


If you need explanation Read this topic

If you need Answer Take test on this topic

Classes855
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();
    }
}

A. MeritCampus
B. To Become JAVA Programmer
C. To Become JAVA Programmer MeritCampus
D. MeritCampus To Become JAVA Programmer
E. Compilation Error
Topic: Advanced Java Programming Concepts

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

ans is D merit constructor is executed first as its object is created first den Campus constructor den go func

Posted by Teja Potlapally    2014-03-12 08:51:52


ans D bcz merit constructor is executed first as its object is created then Campus constructor as Campus() den go func is xexutd

Posted by Pooja Singh    2014-03-12 10:15:31


ANS : D as after CONSTRUCTOR makeProgrammer() is calling Campus() and go()

Posted by Deepak Kumar Yadav    2014-03-12 16:18:00


Congratulations Pooja Singh. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-03-13 04:30:24


© meritcampus 2019

All Rights Reserved.

Open In App