package chapter01;//包名
import java.util.*;
public class thelocationofcity//类名 {
public static void main(String[] args) {
System.out.println("Please input three cities:");
Scanner input=new Scanner(System.in);
String s1=input.next();
String s2=input.next();
String s3=input.next();
String max1;
if(s1.compareTo(s2)<0)
{
max1=s1;s1=s2;s2=max1;
}
if(s1.compareTo(s3)<0)
{
max1=s1;s1=s3;s3=max1;
}
if(s2.compareTo(s3)<0)
{
max1=s2;s2=s3;s3=max1;
}
System.out.println("The three cities in alphabetical order are Atlanta Chicago Los"+s3+" "+s2+" "+s1+" ");
}
}
Result: