Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // USE THIS AS A GUIDE FOR NO. 24
- import java.util.*;
- public class AlphabetizeTwoCities {
- public static void main(String[] args) {
- // alphabetize two cities
- Scanner input=new Scanner(System.in);
- System.out.println("Enter 2 cities followed by enter each time");
- String city1=input.nextLine();
- String city2=input.nextLine();
- if (city1.compareTo(city2) < 0)
- {
- System.out.println(city1 + "\n"+city2);
- }
- else
- {
- System.out.println(city2 + "\n"+city1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement