+ 2

How do I compare strings in Java?

26th Sep 2016, 4:32 PM
Andrew Williams
Andrew Williams - avatar
3 Answers
+ 2
.equals()
26th Sep 2016, 4:34 PM
Oliver Brown
Oliver Brown - avatar
+ 2
but why dont ==
26th Sep 2016, 4:34 PM
Andrew Williams
Andrew Williams - avatar
+ 2
== tests for reference equality (whether they are the same object). .equals() tests for value equality (whether they are logically "equal").
26th Sep 2016, 4:34 PM
Oliver Brown
Oliver Brown - avatar