I teach computer science to undergrads and write for The Renegade Coder. I'm most likely taking care of my daughter, watching the Penguins, or reading manga.
Location
Columbus, Ohio
Education
B.S. in CE from CWRU 2016; M.S. in CSE from OSU 2020; PhD in EED from OSU 2024
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 !