JavaChallenge45

Govinda Raj
wolfie/JavaChallenge
Jun 28, 2022

--

Please try to solve the challenge by yourself.

This will challenge your String pool concept. If the content of the String is the same then it will refer to the same instance memory unless you have a new instance, but in the case of StringBuilder and StringBuffer, it does not refer to the same instance memory because when you call toString() method of StringBuilder and StringBuffer class, it creates the copy of the content with a new instance.

The implementation of StringBuffer -> toString() method —

The implementation of StringBuilder -> toString() method —

Hope you enjoyed the challenge. Let me know if you want more such challenges.

Thank you.

--

--

Govinda Raj
wolfie/JavaChallenge

Senior Software Developer. Tech Enthusiast and love coding. My portfolio: https://govinda-raj.github.io/