Assignment # 50 and Compare
Code
/// Name: Tommy Oyuntseren
/// Period: 7
/// Program Name: Compare
/// File Name: Compare.java
/// Date: 11/19/2015
import java.util.Scanner;
public class Compare
{
public static void main(String[] args)
{
System.out.println(" This is the compareTo() challenge!!!");
String[][] values =
{{"axe","dog"},
{"run","walk"},
{"stop","go"},
{"leg","foot"},
{"terrible","excellent"},
{"right","left"},
{"big", "small"},
{"nasty", "yummy"},
{"school","university"},
{"five","fifteen"},
{"pepsi","cola"},
{"snickers","milky way"}};
for (int i = 0;i < 12;i++)
{
System.out.println();
System.out.print("Comparing \""+values[i][0]+"\" with \""+values[i][1]+"\" produces ");
System.out.println(values[i][0].compareTo(values[i][1]));
}
}
}
Picture of the output