The ArrayList works the same as Array but it can dynamically resize and has methods to
add and remove elements in the collection
It has the following methods:
- Add() method to add the elements
- Remove () method to remove the elements
Example 3: ArrayList collection adding and removing the element.
The output will be: