Assignment #50 and compareTo() Challenge
Code
/// Name: Brendan Baird
/// Period: 6
/// Program Name: compareTO() Challenge
/// File Name: CompareToChallenge.java
/// Date Finished: 10/23/2015
public class CompareToChallenge
{
public static void main(String[] args)
{
System.out.print("Comparing \"boy\" with \"cat\" producues ");
System.out.println("boy".compareTo("cat"));
System.out.print("Comparing \"feminism\" with \"girl\" produces ");
System.out.println("feminism".compareTo("girl"));
System.out.print("Comparing \"USA\" with \"murica\" produces ");
System.out.println("USA".compareTo("murica"));
System.out.print("Comparing \"buddhism\" with \"money\" produces ");
System.out.println("buddhism".compareTo("money"));
System.out.print("Comparing \"fire\" with \"water\" produces ");
System.out.println("fire".compareTo("water"));
System.out.print("Comparing \"applesauce\" with \"apple\" produces ");
System.out.println("applesauce".compareTo("apple"));
System.out.print("Comparing \"bornagain\" with \"born\" produces ");
System.out.println("bornagain".compareTo("born"));
System.out.print("Comparing \"Brent\" with \"Brendan\" produces ");
System.out.println("Brent".compareTo("Brendan"));
System.out.print("Comparing \"doge\" with \"dog\" produces ");
System.out.println("doge".compareTo("dog"));
System.out.print("Comparing \"handsome\" with \"hand\" produces ");
System.out.println("handsome".compareTo("hand"));
System.out.print("Comparing \"acadeca\" with \"acadeca\" produces ");
System.out.println("acadeca".compareTo("acadeca"));
System.out.print("Comparing \"memes\" with \"memes\" produces ");
System.out.println("memes".compareTo("memes"));
}
}
Picture of the output