// // read two strings and out the comparison import java.util.Scanner; class StrComp { public static void main(String[] args) { Scanner input = new Scanner(System.in); String str1, str2; boolean go = true; String ans; while(go) { System.out.print("Two strings: "); str1 = input.next(); str2 = input.next(); //System.out.println("The input is: " + str1 + "\t" + str2); if(str1.compareTo(str2) > 0) System.out.println(str1 + " > " + str2); else if(str1.compareTo(str2) < 0) System.out.println(str1 + " < " + str2); else System.out.println(str1 + " == " + str2); System.out.print("Quit? (y/n)? "); ans = input.next(); if(ans.equalsIgnoreCase("y")) go = false; } System.out.println("\n\ndone.\n\n"); } }