Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. Scanner sc = new Scanner(System.in);
  2.  
  3. ArrayList<Double> stock = new ArrayList<Double>();
  4.  
  5. String s = sc.nextLine();
  6.  
  7. String[] split = s.split("\s+");
  8.  
  9. for (int i=0; i<split.length; i++)
  10. {
  11. stock.add(Double.parseDouble(split[i]));
  12. }
  13.  
  14. Scanner sc = new Scanner(System.in);
  15.  
  16. ArrayList<Double> stock = new ArrayList<Double>();
  17.  
  18. while (sc.hasNextDouble())
  19. {
  20. double d = sc.nextDouble();
  21.  
  22. stock.add(d);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement