Name four Container classes.

Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane.

In Core Java, container classes typically refer to classes that hold and manage other objects. Here are four container classes in Java:

  1. ArrayList: It’s a dynamic array implementation of the List interface, allowing the dynamic resizing of the array as elements are added or removed.
java
List<String> list = new ArrayList<>();
  1. LinkedList: It’s a doubly-linked list implementation of the List interface, providing fast insertion and deletion but slower random access compared to ArrayList.
java
List<String> linkedList = new LinkedList<>();
  1. HashMap: It’s an implementation of the Map interface, using a hash table to store key-value pairs. It provides fast retrieval and insertion.
java
Map<String, Integer> hashMap = new HashMap<>();
  1. HashSet: It’s an implementation of the Set interface, using a hash table to store unique elements. It does not allow duplicate elements.
java
Set<String> hashSet = new HashSet<>();

These classes are part of the Java Collections Framework and are commonly used for storing and managing groups of objects.