How to print only the arraylist values without repeating the highlighted text part
referred the solutions provided but looks complex, please provide a simple solution on how to print only the values
import java.util.Arrays;
public class DuplicateNuminArray {
public static void main(String[] args) {
// TODO Auto-generated method stub
String progLanguages[] = {"Java", "Python", "C", "C++", "Java", "C"};
for (int i = 0; i < progLanguages.length; i++) {
for (int j = i+1; j < progLanguages.length; j++)
{
if(progLanguages[i].equals(progLanguages[j]))
{
System.out.println("The Duplicate string is :" +progLanguages[i]);
}
}
}
}
I expect the print statemenet to print only as below
The Duplicate string is :Java, C
instead of
The Duplicate string is :Java
The Duplicate string is :C