Assignemnt #50 Compare To Challenge
Code
///Name: Morgan Kaplan
///Period: 5
///Project Name: Compare To Challenge
///File Name: CompareTo.java
public class CompareTo
{
public static void main( String[] args)
{
System.out.println( "Comparing \"stella\" with \"morgan\" produces " );
int i = "stella".compareTo("morgan");
System.out.println( i);
System.out.println( "Comparing \"poop\" and \"doop\" produces " );
System.out.println( "poop".compareTo("doop"));
System.out.println( "Comparing \"zebra\" and \"apple\" produces " );
System.out.println( "zebra".compareTo("apple"));
System.out.println( "Comparing \"so\" and \"ao\" produces " );
System.out.println( "so".compareTo("ao"));
System.out.println( "Comparing \"toop\" and \"euoot\" produces " );
System.out.println( "toop".compareTo("euoot"));
System.out.println( "Comparing \"dog\" and \"dog\" produces " );
System.out.println( "dog".compareTo("dog"));
System.out.println( "Comparing \"fog\" and \"fog\" produces " );
System.out.println( "fog".compareTo("fog"));
System.out.println( "Comparing \"auc\" and \"soc\" produces " );
System.out.println( "auc".compareTo("soc"));
System.out.println( "Comparing \"egg\" and \"zeg\" produces " );
System.out.println( "egg".compareTo("zeg"));
System.out.println( "Comparing \"apple\" and \"zarn\" produces " );
System.out.println( "apple".compareTo("zarn"));
System.out.println( "Comparing \"alli\" and \"zar\" produces " );
System.out.println( "alli".compareTo("zar"));
System.out.println( "Comparing \"arc\" and \"zapp\" produces " );
System.out.println( "arc".compareTo("zapp"));
}
}
Picture of Output