Remove duplicate characters in a string present in a sentence using Java?
Answers
Answer:
Java program to delete duplicate characters from a given String
Convert it into a character array.
Try to insert elements of the above-created array into a hash set using add method.
If the addition is successful this method returns true.
Since Set doesn't allow duplicate elements this method returns 0 when you try to insert duplicate elements.
Print those elements.
Answer:
Java program to delete duplicate characters from a given String
Convert it into a character array.
Try to insert elements of the above-created array into a hash set using add method.
If the addition is successful this method returns true.
Since Set doesn't allow duplicate elements this method returns 0 when you try to insert duplicate elements.
Print those elements.
Explanation:
i hope it's helpful