Skip to main content
added both test flavors
Source Link
WiseTechi
  • 3.6k
  • 1
  • 24
  • 15

In your example you are comparing the string objects, not their content.

Your comparison should be :

if ("/quit"s.equals(s"/quit")) 

In your example you are comparing theOr if s string objects, not their content.nullity doesn't mind / or you really don't like NPEs:

if ("/quit".equals(s)) 

Your comparison should be :

if ("/quit".equals(s)) 

In your example you are comparing the string objects, not their content.

In your example you are comparing the string objects, not their content.

Your comparison should be :

if (s.equals("/quit")) 

Or if s string nullity doesn't mind / or you really don't like NPEs:

if ("/quit".equals(s)) 
code formatting
Source Link
Joachim Sauer
  • 309.3k
  • 59
  • 568
  • 624

Your comparison should be :

if ("/quit".equals(s))

if ("/quit".equals(s)) 

In your example you are comparing the string objects, not their content.

Your comparison should be :

if ("/quit".equals(s))

In your example you are comparing the string objects, not their content.

Your comparison should be :

if ("/quit".equals(s)) 

In your example you are comparing the string objects, not their content.

Source Link
WiseTechi
  • 3.6k
  • 1
  • 24
  • 15

Your comparison should be :

if ("/quit".equals(s))

In your example you are comparing the string objects, not their content.