here is the source code ....
class removeDuplicates {
public static void main(String args[]) {
char[] chr = {
'g',
'a',
'a',
'y',
'a',
'd',
'a',
'v'
};
boolean[] ch = new boolean[256];
String str1 = new String(chr);
System.out.println("your entered string " + str1);
int len = chr.length;
for (int s = 0; s < len; s++) {
int g = chr[s];
if (ch[g]) {
chr[s] = '\0';
for (int a = s; a < len; a++) {
if (a == len - 1) {
break;
}
chr[a] = chr[a + 1];
chr[a + 1] = '\0';
}
len--;
s--;
} else {
ch[g] = true;
}
}
String str = new String(chr);
System.out.print(str);
//System.out.println(str.length());
}
}