import java.util.Collections;
import java.util.List;
import java.util.Vector;
public class MainClass {
public static void main(String args[]) {
Vector v = new Vector(5);
for (int i = 0; i < 10; i++) {
v.add(0, i);
}
System.out.println(v);
System.out.println(v.size());
List l = Collections.unmodifiableList(v);
l.add(1);
System.out.println(l);
}
}
[9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableCollection.add(Collections.java:1018)
at MainClass.main(MainClass.java:16)