Why do I have to use SomeRandomString.equals("something") instead of SomeRandomString == "something" in Java? [duplicate]

  algorithm, android, equals, java, string

I’m relatively new to Java so I’m kind of lost here. Is it wrong when you are trying to compare two strings just use the identical symbol "==" instead of using a method for checking if two strings are identical. Because for what I have tried the first option doesn’t work and I’m very curious on the reason behing it

Source: Android Questions

LEAVE A COMMENT