I read that string comparison using == should not be done, however when I use it in code it seems to work. Is this something that was changed in recent versions of Java? For example the following works and prints true. If I change one value it returns false. The Netbeans IDE does give me the warning "comparing string with ==", and I do understand the logic on comparing object references etc. Appreciate your response.
to elaborate on what Bear said: any Strings which are compile-time constants (see the index to the Java™ Language Specification) are put into a pool; if the same compile-time constant String is used again, the same object is used. Then == will work.
Have you seen what it says in the String documentation about "can be safely shared"? That is something similar; the Strings are here being shared.
Try this:Execute with