Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.List;
- import java.util.Scanner;
- public class SortNumeric {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- List<Integer> pool = new ArrayList<Integer>();
- while (true) {
- System.out.print("? ");
- int a = new Integer(in.nextLine());
- if (a == -1) break;
- if (a < 0) continue;
- pool.add(a);
- }
- in.close();
- Collections.sort(pool);
- System.out.println(pool);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement