Question: Write a class named Duplicate and include a method that removes the duplicate elements from an array list of strings using the following header: public

Write a class named Duplicate and include a method that removes the duplicate elements from an array list of strings using the following header:

public static void removeDuplicate(ArrayList list)

Write a test class DuplicateTest that prompts the user to enter 10 names to a list and displays the distinct names separated by exactly one comma and space sorted in descending order. Here is exact code run:

Enter name #1: John

Enter name #2: Smith

Enter name #3: Steve

Enter name #4: Hani

Enter name #5: Ali

Enter name #6: Steve

Enter name #7: Smith

Enter name #8: Steve

Enter name #9: Hani

Enter name #10: Smith

The distinct names sorted are: Steve, Smith, John, Hani, Ali

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!