I have some problems when trying to copy two arrays. Consider the following simple code:
ArrayList<Integer> t1 = new ArrayList<Integer>(); Integer i1 = new Integer(1); Integer i2 = new Integer(2); t1.add(i1); t1.add(i2); ArrayList<Integer> t2 = new ArrayList<Integer>(); System.arraycopy(t1, 0, t2, 0, t1.size());
The console shows: java.lang.ArrayStoreException: null. What could be wrong in this code or how can I do it differently. Sorry, maybe a difficult question, but I got stuck on it for several hours and cannot fix it.
gadon source share