public class MainClass {
public static void main(String[] arg) {
String string1 = "abcde";
String string2 = "bcdef";
if(string1.compareTo(string2) > 0) {
System.out.println("greater");
}
if(string1.compareTo(string2) == 0) {
System.out.println("equal");
}
if(string1.compareTo(string2) < 0) {
System.out.println("less");
}
}
}
|