Menu
Question Index
...

What will be the output of following program?

public class Additions {
    public static void main(String[] args) {
        String number = 50 + 40 + "Sum" + 50 + 40;
        String s = "Sum = ";
        System.out.println(s + number);
        String str = 50 + 40 + "";
        String srt = "Sum";
        System.out.printf(s, str.concat(srt));
    }
}


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