new Boolean() vs. static Boolean constants - how java compiler handles them
A coworker commented today that it is better practice to use static Boolean constants instead of creating new Boolean objects because Booleans are immutable and creating new Boolean objects would therefore be a waste of memory. For eg. do Boolean.TRUE instead of new Boolean(true). However a friend responded that a good java compiler would take care of that. Does anyone know if that is true? And if so, do most java compilers implement that optimization and is it safe to assume that it is a given?

