Menu
Question Index
...

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");
    }
}


MERIT67657780858312
MERIT4382
MERITCAMPUS2
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Create Objects Using 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