public static void main(String[] args) {
int arr[] = {6,2,9,6,1,2,6,7,8};
for (int i = 0;i < arr.length ;i++ ) {
for (int j = i+1;j < arr.length ;j ++ ) {
if (arr[i] == arr [j]) {
arr[j] = -1;
}
}
}
for (int i = 0;i < arr.length ;i ++ ) {
if (arr[i] == -1) {
continue;
}
System.out.print(arr[i]);
}
} |
|