-
How is Arrays.asList() different than the standard way of initialising List?
-
- We cannot access the list returned using Arrays.asList()
- Arrays.asList() returns a fixed length list and doesn’t allow to add or remove elements
- Both are same
- Arrays.asList() throws compilation error
- None of these
Correct Option: B
List returned by Arrays.asList() is a fixed length list which doesn’t allow us to add or remove element from it.add() and remove() method will throw UnSupportedOperationException if used.