View Code of Problem 78

package zgs.exam.day08;
 
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<String> list = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            String string = sc.nextLine();
            list.add(string);
        }
        Collections.sort(list);
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }
}

Double click to view unformatted code.


Back to problem 78