Menu
Question Index
...

What will be the output of following program?

public class Master {
    public static void main(String[] args) {
        String number1 = 50 + "";
        String number2 = 40 + "";
        String sum = "Sum";
        String first = number1.concat(number2);
        String second = first.concat(sum);
        second = second.concat(number1);
        second = second.concat(number2);
        System.out.print(second);
    }
}


5040Sum5040
90Sum90
90Sum5040
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