Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • Note that other modern languages on the JVM, such as Scala, use == to mean "equal strings". Commented Mar 14, 2016 at 15:16
  • @AndresF. (shrug) In Java, "<" means "less than", while in XML it "opens a tag". In VB "=" can mean "is equal to", while in Java it's only used for assignment. Etc. It's hardly surprising that different languages use different symbols to mean the same thing, or the same symbol to mean different things. Commented Mar 14, 2016 at 18:31
  • It wasn't a dig at your answer. It was just a comment. I was just pointing out that a more modern language than Java took the chance to redesign the meaning of ==, just as you mentioned at the end. Commented Mar 14, 2016 at 18:33
  • @AndresF. And my reply wasn't a dig at your comment, just saying that different languages approach these issues in different ways. :-) I actually like the way VB handles this ... pause for the hisses and boos from the VB haters ... "=" always compares the value (for system-defined types), whether primitive or object. "Is" compares the handles of two objects. That seems more intuitive to me. Commented Mar 14, 2016 at 18:59
  • Sure. But Scala is way closer to Java than Visual Basic. I like to think Scala's designers realized that Java's use of == was error prone. Commented Mar 14, 2016 at 19:08