Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
0
Yea, for primitive wrappers use the .valueOf() expression for using the pool, like Boolean.valueOf(true) instead of new Boolean(true). Strings are handled more automatically, based on your usage. I would recommend to use StringBuilder.append("...") instead of variable += "..." mainly when it occurs more than one times (in a loop). There are pools, but I don't think they are accessible by the programmer easily (if any way).
21st Jun 2018, 10:52 AM
Magyar Dávid
Magyar Dávid - avatar