Hi, I have got a doubt In String. String objects are Immutable and StringBulider/StringBuffer objects are mutable. Almost we can do all the String functionality in StringBulider. Then why we need to use String instead of String builder/StringBuffer. Is there any specific reason available for using String? kindly clarify my doubt.
Jump to Post
Strings are supported as a special case in the compiler and are very highly optimised. The fact that they are immutable allows all kinds of optimisations that are not possible for mutable objects, especially in a multi-threaded environment.
All 3 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.