8th Jul 2019, 9:06 AM
sushmitha R
2 Respostas
+ 3
array[]={"black","white","black","black","black"}; String temp=null; // string which have empty value "" int count=0; //array.length the size of array for(int i=0;i<array.length;i++){ temp=array[i]; //assign the value each array element to temp for(int j=0;j<array.length;j++){ if(temp==array[j]) //to check the the temp value is equal to each value of the array elements {count+=1;} //if the values are equal count increase by one }if(count<=1){System.out.println("non repeating element is "+temp);}count=0;} } finally it prints non repeating element is white
8th Jul 2019, 9:39 AM
estifanos
estifanos - avatar
+ 3
It prints out all elements of a string array that have no duplicates within the array.
8th Jul 2019, 9:45 AM
Sonic
Sonic - avatar