Technique used in java to make string immutable?
or how can i make my string class immutable.
I just want to know the logic behind this.
In Java, String objects are already immutable.
I can't speak to how the Java language creators specifically made String immutable, but here are some guidelines that you can follow to make your own classes immutable:
private and final.final or use a factory pattern).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With