Share this post on:

Here is an Example in Java to remove Duplicate Character from an String.

public class Demo {
static String reverse="";

public static void main(String[] args) {
Scanner in = new Scanner(;
System.out.println("Enter a String");
String w=in.nextLine();
String n = "";
System.out.println("Original String "+w);
for(int i =0;i<w.length();i++)
    char c=w.charAt(i);
    if(c!=' ')
    w=w.replace(c, ' ');
System.out.println("New Word "+n);


Share this post on:
Avatar Raiyan

Author: Raiyan

Hi, I guess you're here because you want to know a bit about me. huh? I am not so good on talking about myself but I'll give a short about me.

My Name is Raiyan. I am a Professional Application Developer and a Blogger.
I started this website to Share my Knowledge. Here I provide all my knowledge whatever I earned till now.

Leave a Comment

Your email address will not be published. Required fields are marked *