Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Exception in thread "main" java.lang.UnsupportedOperationException
- at java.util.AbstractList.remove(AbstractList.java:161)
- at java.util.AbstractList$Itr.remove(AbstractList.java:375)
- at java.util.AbstractCollection.remove(AbstractCollection.java:269)
- at test4.test4.main(Question4.java:21)
- package test4;
- import java.util.Arrays;
- public class test4 {
- public static void main(String[] args) {
- String[] a = new String[]{ "A", "b", "C", "$", "$", "$", "d", "s", "w", "t", "Z",
- "r", "I", "o", "A", "b", "C", "$", "$", "$", "d", "s", "w", "t" };
- String[] b = new String[a.length];
- int num = 0;
- for(int i =0; i<a.length; i++){
- if(Character.isUpperCase(i)){
- num++;
- }
- if(Arrays.asList(a).contains("$")){
- Arrays.asList(a).remove("$");
- b[i] =a[i];
- }
- }
- System.out.println("number os uperCase is: " + num);
- System.out.println();
- System.out.println("this is the new Array: " + Arrays.toString(b));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement