Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. A = 7
  2. B = 8
  3.  
  4. import java.util.Scanner;
  5. import java.util.Map;
  6. import java.util.HashMap;
  7.  
  8. public class Commander
  9. {
  10. public static void main(String[] args)
  11. {
  12. Map<String,Integer> expression = new HashMap<String,Integer>();
  13.  
  14. Scanner sc = new Scanner(System.in);
  15. String Variable, assignmentOperator;
  16. int Value, i = 0;
  17.  
  18. while(true)
  19. {
  20. args[i] = sc.nextLine();
  21. args[i + 1] = sc.nextLine();
  22. args[i + 2] = sc.nextLine();
  23.  
  24. expression.put(args[i],Integer.parseInt(args[i + 2]));
  25.  
  26. for(String key: expression.keySet())
  27. System.out.println(key + " - " + expression.get(key));
  28.  
  29. if(!sc.hasNextLine()) break;
  30.  
  31. ++i;
  32.  
  33. }
  34. }
  35. }
  36.  
  37. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
  38. at Commander.main(Commander.java:17)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement