Menu
Question Index
...

What will be the output of the following program?

public class SelfLearning {
    public static void main(String[] args) {
        String output = "";
        String school = "MERIT CAMPUS";
        String input = "JAVA SCHOOL";
        System.out.println(school);
        output.concat("self");
        output.concat(" learning ");
        for (int i = 0; i < input.length(); i++) {
            output = output.concat(input.charAt(i));
        }
        System.out.println(output);
    }
}


MERIT CAMPUS
JAVA SCHOOL
MERIT CAMPUS
self learning JAVA SCHOOL
self learning JAVA SCHOOL
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: concat() method 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