0

equals()

Didn't understand it fully There lies some confusion Need another example ??

20th Feb 2017, 1:15 PM
Harsh Dhaundiyal
Harsh Dhaundiyal - avatar
1 Odpowiedź
+ 1
in other languages you can (but shouldn't) use the == operator to compare strings. in java they use .equals() as its counter part. it returns a boolean if im not mistaken, allowing you to use them within conditional statements. String str1 = "text; String str2 = "text; if (str1.equals(str2)){ log. ("same"); }... and so on. hope this helps!
20th Feb 2017, 2:23 PM
Michael Szczepanski
Michael Szczepanski - avatar