+ 1

quality opperator in java

with String

13th Nov 2020, 6:04 AM
Falak Brakat
Falak Brakat - avatar
2 Answers
+ 2
There is equals() method in Java which compares two strings, and returns true if the strings are equal, and false if not. But I guess it's better to use compareTo if you want to compare two Strings lexicographycally.
13th Nov 2020, 10:54 AM
Minho
Minho - avatar
+ 1
If you are speaking about equality operator of strings in Java :it doesn't exist but there is method to campare which is used like this: str1.compareTo(str2) It return a + value if str1>str2 A - value if str1<str2 A 0 if str1= str2
13th Nov 2020, 6:19 AM
CHERIEF Houcine Abdelkader
CHERIEF Houcine Abdelkader - avatar