JAVA
Free Section Starter Challenge
35 min
5. Java Collections: ArrayList & HashMap
Overview: Store dynamic data structures using the Java Collections Framework: generic ArrayLists and key-value HashMaps.
Concept & Syntax Guide
Unlike primitive arrays with fixed sizes, Java's `ArrayList<T>` grows dynamically as elements are added. `HashMap<K, V>` provides constant-time performance for key-value lookups.
Hands-On Practice Exercise
Store and Iterate Course Catalog in ArrayList
Create an `ArrayList<String>` for course titles, add "Modern PHP 8" and "React Masterclass", and print the list size.
Target Output:
Total Courses Enrolled: 2
Need a hint? Click here to reveal
Hint: Check syntax carefully and make sure your code contains:
Total Courses Enrolled: 2
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10