Home / Programming MCQs / JAVA MCQs / Question

Q. What is the output of the following code snippet?

String s1 = “Hello”;
String s2 = “World”;
System.out.println(s1 + s2);
(A) HelloWorld
(B) Hello World
(C) Error
(D) None of the above


In Java, the + operator can be used to concatenate two strings. In this case, s1 + s2 returns “HelloWorld”.

You must be Logged in to update hint/solution


Login to discuss.