Assignemnt #50 - Compare
Code
/// Name: Caelan Dorstad
/// Period: 6
/// Program Name: Compare
/// File Name: Compare.java
/// Date Finished: 10/29/2015
public class Compare{
public static void main(String[] args){
// number less than 0, five examples which result in a number greater than 0, and two examples which give you exactly 0.
System.out.print("Comparing \"axe\" with \"dog\" produces ");
int i = "axe".compareTo("dog");
System.out.println(i);
System.out.print("Comparing \"applebee's\" with \"apple\" produces ");
System.out.println( "applebee's".compareTo("apple"));
System.out.print(" game to pizza ");
System.out.println( "game".compareTo("pizza"));
System.out.print(" phone to chicken ");
System.out.println( "phone".compareTo("chicken"));
}
}
Picture of the output