Write a program to ArrayList  in Java.

 

Output: