4 ms·
The problem is that, per the spec, the following must hold: if("abc" == "abc") { System.out.println("correct"); } if(new String("abc") != new String("abc")
by simiones 3y ago
The problem is that, per the spec, the following must hold:
if("abc" == "abc") { System.out.println("correct"); }
if(new String("abc") != new String("abc")) { System.out.println("correct"); }
So, not having proper string interning support means that you mis-execute certain programs.
- kelnos 3y agoSure, but also consider that this JVM (intentionally) lacks support for other things that all but the most trivial programs would use. I don't think it's expected by the author that you can throw any random program at it. It's really there just to run your own programs that you've written specifically for it in order to play around with things. And since you know you're writing for this particular JVM, you should know not to do anything that depends on string interning, among other things.