How can i make the words in alphabetical order if there are not the same ???
import java.util.Scanner;
public class Alphabetize{
public static void main (String [] args) {
Scanner input = new Scanner (System.in);
System.out.println("Enter three words");
String Word1, Word2, Word3;
Word1 = input.next();
Word2 = input.next();
Word3 = input.next();
boolean A = Word1.matches(Word2);
boolean B = Word2.matches(Word3);
boolean C = Word3.matches(Word1);
boolean D = Word3.matches(Word2);
if (A==true)
{
if (B==true)
if (C==true)
if (D==true)
System.out.println("All three of those words are the same :" + Word1 +" "+ Word2+" "+ Word3);
}
else
{
System.out.println("In alphabetical order those are :" + Word1 +" "+ Word2+" "+ Word3 );
}
}
}