Guest User

Untitled

a guest
Nov 21st, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. private String bName;
  2. private List<Integer> X = new ArrayList<Integer>();
  3. private WhiteBags W;
  4.  
  5.  
  6. Bags(File fil,String c, String a) throws WrongPath, NegativeInteger{
  7. this.bName = c;
  8. this.W = new WhiteBags(a);
  9. FileReader inputFil;
  10. BufferedReader in;
  11. try {
  12. inputFil = new FileReader(fil);
  13. in = new BufferedReader(inputFil);
  14.  
  15. String s = in.readLine();
  16. System.out.println(s);
  17.  
  18. for(String n:s.split(", ")){
  19. X.add(Integer.parseInt(n));
  20. }
  21. in.close();
  22. } catch (IOException e){
  23. throw new WrongPath("File doesn't exists");
  24. }
  25.  
  26. }
  27.  
  28. Exception in thread "main" java.lang.NumberFormatException: For input string: "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100"
  29. at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
  30. at java.lang.Integer.parseInt(Integer.java:458)
  31. at java.lang.Integer.parseInt(Integer.java:499)
  32. at Bags.<init>(Bags.java:27)
  33. at test.main(test.java:5)
Add Comment
Please, Sign In to add comment