Given:
What is the output?
Java String values are immutable. Each assigned concat call extends ta, but the unassigned replace("B", "C") result is discarded, so B remains unchanged. The printed value is A B C D.
String
concat
ta
replace("B", "C")
B
A B C D
Community Discussion