Advertisement
Dido09

ArrayList

Mar 20th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. package JavaBook;
  2.  
  3. import java.util.*;
  4.  
  5. public class ArrayLists {
  6.  
  7. public static void main(String[] args) {
  8. Scanner scan = new Scanner(System.in);
  9. ArrayList<Integer> nums = new ArrayList<Integer>();
  10. for(int i = 0; i <= 9; i++){
  11. int n = Integer.parseInt(scan.nextLine());
  12. nums.add(n);
  13. }
  14. Collections.sort(nums);
  15. for(int i = 0; i < nums.size(); i++) {
  16. System.out.println(nums.get(i));
  17. }
  18. }
  19.  
  20. }
  21.  
  22.  
  23. //Special Thanks to Marian
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement