Never use == to compare string contents. The == operator checks whether two variables point to the same object in memory, not whether they contain the same text. Use .equals() instead.
String a = new String("hello");
String b = new String("hello");
System.out.println(a == b);
System.out.println(a.equals(b));
This prints false then true. The two objects hold the same text but live at different memory addresses, so == fails.
For ordering, use .compareTo(). It returns a negative number if the first string comes before the second alphabetically, if they are equal, and a positive number if it comes after.
System.out.println("apple".compareTo("banana"));
System.out.println("banana".compareTo("apple"));
The first call returns a negative value. The second returns a positive value. Both .equals() and .compareTo() are case-sensitive. Use .equalsIgnoreCase() or .compareToIgnoreCase() when case should not matter.