Q. What will be the output?

Code:
String s = "Java";
s.concat(" World");
System.out.println(s);
  • (A) Java
  • (B) Java World
  • (C) Compilation Error
  • (D) Runtime Error
πŸ’¬ Discuss
βœ… Correct Answer: (A) Java
Explanation: Strings are immutable. concat() returns a new string but does not modify the original.
Explanation by: Roshan
Strings are immutable. concat() returns a new string but does not modify the original.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
20
Total Visits
πŸ“½οΈ
4 mo ago
Published
πŸŽ–οΈ
Roshan
Publisher
πŸ“ˆ
93%
Success Rate