I learned that it is from the devil to test String equality with ==
instead of String.equals()
, because every String was a reference to its own obj
It hasn't changed. However, the Java Compiler uses string.intern() to make sure that identical strings in source code compile to same String object. If however you load a String from a File or Database it will not be the same object, unless you force this using String.intern() or some other method.
It is a bad idea, and you should still use .equals()