//Example illustrating use of compareTo()import java.io.*;public class CompareToDemo2{	private static BufferedReader stdin = 		new BufferedReader( new InputStreamReader( System.in ) );	public static void main( String [] args ) throws IOException	{		System.out.print("Please enter a string: ");		String str1 = stdin.readLine();		System.out.print("Please enter another string: ");		String str2 = stdin.readLine();				if (str1.compareTo(str2) < 0)		{			System.out.println(str1 + " is alphabetically BEFORE " + str2);		}				if (str1.compareTo(str2) == 0)		{			System.out.println(str1 + " is alphabetically EQUAL TO " + str2);		}				if (str1.compareTo(str2) > 0)		{			System.out.println(str1 + " is alphabetically AFTER " + str2);		}	}}