A

Admin • 828.70K Points
Coach

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

Code:
String s1 = “Hello”;
String s2 = “World”;
System.out.println(sA)concat(s2));
  • (A) HelloWorld
  • (B) Hello World
  • (C) Error
  • (D) None of the above
  • Correct Answer - Option(A)
  • Views: 5
  • Filed under category Java
  • Hashtags:

Explanation by: Admin
The concat method in Java concatenates two strings together, returning a new string that is the combination of the two. In this case, sA)concat(s2) returns “HelloWorld”.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.