// // Assignment ? // // File: TestStringCompare.java // Author: John Wang // Instructor: Dr. John Wang // Due: Feb. 1, 2016 // Goal: Will test string compare method: compareTo() // import java.util.Scanner; class TestStringCompare { public static void main(String[] args) { Scanner input = new Scanner(System.in); String str1, str2; System.out.print("Two strings: "); str1 = input.next(); str2 = input.next(); System.out.println("They are: " + str1 + "\t" + str2); if(str1.compareTo(str2) < 0) System.out.println(str1 + " is before " + str2); else System.out.println(str1 + " is after " + str2); System.out.println("\n\nDone.\n\n\n"); } }