I often saw people saying String str = new String("my string")
is less efficient than writing String str = "my string",
because the former creates a static "my string" object and then new's a String object that gets copied from the static one.
However, given that the language here is so simple and unambiguous, I can hardly imagine that Java optimizer won't take any effort to simply convert the former to the latter. Why would it really choose to do it the more laborious way? What can any negative side effects be if Java does optimize it?