how to compare alphabetical order in java code example
Example: java compare strings alphabetically
String a = "HYRE";
String b = "AGNYG";
int compare = a.compareTo(b);
if (compare < 0) {
//a is smaller
}
else if (compare > 0) {
//a is larger
}
else {
//a is equal to b
}