Top 50+ ArrayList Interview Questions in Java

Test Your Knowledge

45. Suppose we have a Student class and have to add its objects in an ArrayList. Now, the list has to be stored on the basis of the studentID of Student class. What will be the following steps involved?

Answer: Go to this tutorial: How to store user-defined class objects in ArrayList.

46. What are concrete classes implementing List interface in Java?

47. Why is it preferred to declare: List list = new ArrayList(); instead of ArrayList arList = new ArrayList();?

48. How to make an ArrayList read-only?

49. How to sort an ArrayList or a list in reverse order?

50. What are collections classes that implement Random Access Interface?

51. How to avoid ConcurrentModificationException during the iteration of a collection?

52. Can we pass List<String> to a method that accepts List<Object>?

53. What is the difference between size and capacity of ArrayList in Java?

Answer: The number of elements present in an ArrayList is called size of ArrayList.

The capability to store elements in an ArrayList is called capacity of ArrayList. The initial default capacity of an ArrayList is 10.

Hope that this tutorial has covered all the important ArrayList interview questions in Java with answers. I hope that you will have understood all answers to ArrayList interview questions and practiced coding problems.
All the best!!!