Java Program to find duplicate Characters in a String

Previous
Next
In this post, we will see how to find duplicate Characters in a String.

Approach:

  1. Create a HashMap and character of String will be inserted as key and its count as value.
  2. If Hashamap already contains char,increase its count by 1, else put char in HashMap
  3. If value of Char is more than 1, that means it is duplicate character in that String

Java Program to find duplicate Characters in a String


When you run above program, you will get below output:

Other String Programs :

Previous
Next

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.

One Response

  1. R Shenoy October 23, 2016

Add Comment

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.
You can like our facebook page Java2blog