Posts

Java collection interview questions

In Java, collection interview questions are most asked by the interviewers. Here is the list of the most asked collections interview questions with answers. 1) What is the Collection framework in Java? Collection Framework is a combination of classes and interface, which is used to store and manipulate the data in the form of objects. It provides various classes such as ArrayList, Vector, Stack, and HashSet, etc. and interfaces such as List, Queue, Set, etc. for this purpose. 2) What are the main differences between array and collection? Array and Collection are somewhat similar regarding storing the references of objects and manipulating the data, but they differ in many ways. The main differences between the array and Collection are defined below: Arrays are always of fixed size, i.e., a user can not increase or decrease the length of the array according to their requirement or at runtime, but In Collection, size can be changed dynamically as per need. Arrays can only