Advertisement
DulcetAirman

Sort Input

Jul 1st, 2019
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. package ch.claude_martin;
  2.  
  3. import static java.lang.System.*;
  4. import java.util.Scanner;
  5. import java.util.stream.IntStream;
  6.  
  7. public final class SomeClass {
  8.   public static void main(String... args) {
  9.     out.println("Enter five lines of Text:");
  10.     try (var s = new Scanner(in)) {
  11.       IntStream.range(0, 5).mapToObj(i -> s.nextLine()).sorted().forEach(out::println);
  12.     }
  13.   }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement