Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

“But if new operator is used, it explicitly creates a new String and then add it to the pool.” Operator new creates a new String but doesn’t add String to the pool. Method intern() does that.
- Mikhail Seleznev
If we look both String and StringBuilder both are final class and fields are also final, then what extra property is there in String class, that make it immutable and StringBuilder as immutable. Please provide me the solution. Q2:-When we are creating our custom immutable class, generally we are making our class as 1)final, 2)all the fields are making final and initializing them with the help of constructor 3) only providing the getter methods, no setter methods It will holds good for primitive type data Type or immutable class(StringBuffer), what if in our class there is a mutable property is there, how to achieve immutable in that case. Please provide me the answer with example. From a long time I was looking for this answer. nb:- from interet I found something like make the defense copy of that property, but I didn’t get how exactly I ll achieve that.
- subrat panda
+ operator is overloaded for String and used to concatenate two Strings. Although internally it uses StringBuffer to perform this action. As I know internally it is uses StringBuilder to perform this action.
- emilio
Pankaj, On the very same context, also include a note for StringJoiner.
- Krishna Revuru
please correct me if i am wrong string in string pool is not garbage collected and string in heap are garbage collected right ?
- rizwan