I think string pooling generally does not apply when the variable is created using ... = new String("bla");
In your example : String a = new String("Leroy"); String b = new String("Leroy");
a == b // this is now false;
Here is a good article on this specific topic : baeldung.com/java-string-pool
Awesome! Thanks, I've updated the italicized bit.
No problem. Have a great day !
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think string pooling generally does not apply when the variable is created using ... = new String("bla");
In your example :
String a = new String("Leroy");
String b = new String("Leroy");
a == b // this is now false;
Here is a good article on this specific topic : baeldung.com/java-string-pool
Awesome! Thanks, I've updated the italicized bit.
No problem. Have a great day !