<<< Another if-else example | Index | Comparing Strings Examples >>> |
Unfortunately, Java does not allow relational operators (>, <, >=, <=, ==, !=) to compare strings.
In Java, Strings are objects, and objects have two methods for comparing Strings:
equals(String) -- case sensitive
equalsIgnoreCase(String) -- not case sensitive
Both methods return a Boolean true or false
<<< Another if-else example | Index | Comparing Strings Examples >>> |