import java.util.ArrayList; public class MyArrayListExample { public static void main(String[] args) { ArrayListmyArrayList = new ArrayList<>(); myArrayList.add("Java"); myArrayList.add("Python"); myArrayList.add("C++"); System.out.println(myArrayList); } }
import java.util.HashMap; public class MyHashMapExample { public static void main(String[] args) { HashMapmyHashMap = new HashMap<>(); myHashMap.put("John", 25); myHashMap.put("Mary", 30); myHashMap.put("Bob", 40); System.out.println(myHashMap.get("Mary")); } }
import java.util.LinkedList; public class MyLinkedListExample { public static void main(String[] args) { LinkedListAll the examples use java.util package library.myLinkedList = new LinkedList<>(); myLinkedList.add("Apple"); myLinkedList.add("Banana"); myLinkedList.add("Cherry"); System.out.println(myLinkedList); } }