Menu
Topics Index
...
`

Strings2012


If you need explanation Read this topic

If you need Answer Take test on this topic

Strings2012
What will be the output of the following program?
public class StringOut {
    public static void main(String[] args) {
        Merit m = new Merit();
        Campus c = new Campus();
    }
}
class Merit {
    Merit() {
        System.out.print("M" + "E" + "R" + "I" + "T");
    }
}
class Campus {
    public Campus() {
        System.out.print('C' + 'A' + 'M' + 'P' + 'U' + 'S' + '1' + "2");
    }
}

A. MERIT67657780858312
B. MERIT4382
C. MERITCAMPUS2
D. Some other output
E. Compilation Error or Runtime Error
Topic: Create Objects Using Constructors In Java

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.. first sop statement prints the string...2nd is an arithmetic expression and concatenation ...
MERIT5062

Posted by Santosh Munugota    2013-12-11 09:06:28


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

Posted by Merit Campus    2013-12-12 03:35:25


© meritcampus 2019

All Rights Reserved.

Open In App