Multiple choice technology programming languages

What will be output of this program? String str="TCS"; str.concat("Bangalore");

  1. TCS

  2. Bangalore

  3. TCS Bangalore

  4. Syntax Error

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In Java, String objects are immutable. Calling str.concat("Bangalore") creates a new String object containing "TCSBangalore", but it does not modify the original reference str. Therefore, str remains "TCS".