Assignment #50
Code
/// Name: Kabir Virk
/// Period: 6
/// Program Name: CompareToChallenge
/// File Name: CompareToChallenge.java
/// Date Finished: 11/13/2015
public class CompareToChallenge
{
public static void main(String[] args)
{
System.out.print("Comparing \"potato\" with \"food\" producues ");
System.out.println("potato".compareTo("food"));
System.out.print("Comparing \"jeans\" with \"genes\" produces ");
System.out.println("jeans".compareTo("genes"));
System.out.print("Comparing \"dogs\" with \"cats\" produces ");
System.out.println("dogs".compareTo("cats"));
System.out.print("Comparing \"ball\" with \"stick\" produces ");
System.out.println("ball".compareTo("stick"));
System.out.print("Comparing \"fire\" with \"ice\" produces ");
System.out.println("fire".compareTo("ice"));
System.out.print("Comparing \"noodles\" with \"rice\" produces ");
System.out.println("noodles".compareTo("rice"));
System.out.print("Comparing \"movietheater\" with \"movie\" produces ");
System.out.println("movietheater".compareTo("movie"));
System.out.print("Comparing \"mouse\" with \"mice\" produces ");
System.out.println("mouse".compareTo("mice"));
System.out.print("Comparing \"phone\" with \"screen\" produces ");
System.out.println("phone".compareTo("screen"));
System.out.print("Comparing \"water\" with \"waterbottle\" produces ");
System.out.println("water".compareTo("waterbottle"));
System.out.print("Comparing \"potato\" with \"potato\" produces ");
System.out.println("potato".compareTo("potato"));
System.out.print("Comparing \"woof\" with \"woof\" produces ");
System.out.println("woof".compareTo("woof"));
}
}
Picture of the output