List Created like this
List<Integer> list = Arrays.asList(array);
** *: If you use the add method etc., a run-time error will occur ** Since it only refers to array, if you change array, it will be reflected.
ArrayList Created like this
List<Integer> arrayList = new ArrayList<Integer>(Arrays.asList(array));
As you pointed out and the content was interesting, it is described
The reason for throwing an exception when using the ʻadd
method of ʻArrayList, which is the return value of ʻArrays.asList (array)`, is as follows.
class does not inherit from the ʻaddmethod and uses the ʻadd` method of the parent class.
inherited by the ʻArrayListclass implements ʻadd` to throw an exception (because it is premised on overriding).
is an inner class of ʻArraysand is different from ʻArrayList` in the text.