Assignment #50 Compare To Challenge
Code
/// Name: Lacey Reese
/// Period: 5
/// Program Name: CompareToChallenge
/// File Name: CompareToChallenge.java
/// Date Finished 11/17/2015
public class CompareToChallenge
{
public static void main( String[] args )
{
System.out.print("Comparing \"vanilla\" with \"chocolate\" produces " );
System.out.println ("vanilla".compareTo("Chocolate"));
System.out.print("Comparing \"snails\" with \"slugs\" produces " );
System.out.println ("snails".compareTo("slugs"));
System.out.print("Comparing \"water\" with \"drinking\" produces " );
System.out.println ("water".compareTo("drinking"));
System.out.print("Comparing \"eye\" with \"balls\" produces " );
System.out.println ("eye".compareTo("balls"));
System.out.print("Comparing \"youssef\" with \"lacey\" produces " );
System.out.println ("youssef".compareTo("lacey"));
System.out.print("Comparing \"love\" with \"love\" produces " );
System.out.println ("love".compareTo("love"));
System.out.print("Comparing \"hate \" with \"hate\" produces " );
System.out.println ("hate".compareTo("hate"));
System.out.print("Comparing \"book\" with \"giraffe\" produces " );
System.out.println ("book".compareTo("giraffe"));
System.out.print("Comparing \"movies\" with \"hair\" produces " );
System.out.println ("movies".compareTo("hair"));
System.out.print("Comparing \"cheerios\" with \"dinner\" produces " );
System.out.println ("cheerios".compareTo("dinner"));
System.out.print("Comparing \"bread\" with \"lollipops\" produces " );
System.out.println ("bread".compareTo("lollipops"));
System.out.print("Comparing \"knife\" with \"cats\" produces " );
System.out.println ("knife".compareTo("cats"));
}
}
Picture of the output
//