Answer:
Code is given below:
Explanation:
import java.io.*;
import java.util.*;
import java.util.Scanner;
class Solution {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
ArrayList<String> ans = new ArrayList();
System.out.println("(a) ADD THREE NAMES: ");
for(int i=0;i<3;i++)
{
ans.add(in.next());
}
System.out.println("(b) NUMBER OF ELEMENTS: " + ans.size());
System.out.println("(c) ADD TWO MORE NAMES : ");
for(int i=0;i<2;i++)
{
ans.add(in.next());
}
System.out.println("(d) PRINT ALL NAMES: ");
for(int i=0;i<ans.size();i++)
{
System.out.println(ans.get(i));
}
System.out.println("(e) ENTER A NAME TO REMOVE: ");
ans.remove(in.next());
for(int i=0;i<ans.size();i++)
{
System.out.println(ans.get(i));
}
}
}