Answers to Self-Review Exercises
a) False. String objects are compared using operator == to determine whether they’re the same object in memory.
b) False. String
objects are immutable and cannot be modified after they’re created. StringBuilder
objects can be modified after they’re created.
a) s1.equals(s2)
b) s1 += s2;
c) s1.length()
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.