Assignemnt #50 and Compare To Challenge
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Compare To Challenge
///File Name: CompareToChallenge
///Date Finished: 10/28/15
public class CompareToChallenge
{
public static void main( String[] args )
{
System.out.print("Comparing \"ax\" with \"bag\" produces ");
int i = "ax".compareTo("bag");
System.out.println(i);
System.out.print("Comparing \"axe\" with \"dash\" produces ");
int j = "axe".compareTo("dash");
System.out.println(j);
System.out.print("Comparing \"axe\" with \"cat\" produces ");
int g = "axe".compareTo("cat");
System.out.println(g);
System.out.print("Comparing \"axe\" with \"eat\" produces ");
int h = "axe".compareTo("eat");
System.out.println(h);
System.out.print("Comparing \"axe\" with \"fish\" produces ");
int k = "axe".compareTo("fish");
System.out.println(k);
System.out.print("Comparing \"catch\" with \"cat\" produces ");
int t = "catch".compareTo("cat");
System.out.println(t);
System.out.print("Comparing \"eat\" with \"ate\" produces ");
int s = "eat".compareTo("ate");
System.out.println(s);
System.out.print("Comparing \"try\" with \"tie\" produces ");
int r = "try".compareTo("tie");
System.out.println(r);
System.out.print("Comparing \"prime\" with \"optional\" produces ");
int p = "prime".compareTo("optional");
System.out.println(p);
System.out.print("Comparing \"dance\" with \"ballet\" produces ");
int o = "dance".compareTo("ballet");
System.out.println(o);
System.out.print("Comparing \"dancer\" with \"dancer\" produces ");
int z = "dancer".compareTo("dancer");
System.out.println(z);
System.out.print("Comparing \"tiger\" with \"tiger\" produces ");
int y = "tiger".compareTo("tiger");
System.out.println(y);
}
}
Picture of the output