Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. Exception in thread "main" java.lang.UnsupportedOperationException
  2. at java.util.AbstractList.remove(AbstractList.java:161)
  3. at java.util.AbstractList$Itr.remove(AbstractList.java:375)
  4. at java.util.AbstractCollection.remove(AbstractCollection.java:269)
  5. at test4.test4.main(Question4.java:21)
  6.  
  7. package test4;
  8.  
  9. import java.util.Arrays;
  10.  
  11. public class test4 {
  12.  
  13. public static void main(String[] args) {
  14.  
  15. String[] a = new String[]{ "A", "b", "C", "$", "$", "$", "d", "s", "w", "t", "Z",
  16. "r", "I", "o", "A", "b", "C", "$", "$", "$", "d", "s", "w", "t" };
  17.  
  18. String[] b = new String[a.length];
  19. int num = 0;
  20. for(int i =0; i<a.length; i++){
  21.  
  22. if(Character.isUpperCase(i)){
  23. num++;
  24. }
  25. if(Arrays.asList(a).contains("$")){
  26.  
  27. Arrays.asList(a).remove("$");
  28. b[i] =a[i];
  29. }
  30. }
  31. System.out.println("number os uperCase is: " + num);
  32. System.out.println();
  33. System.out.println("this is the new Array: " + Arrays.toString(b));
  34.  
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement