I'd like to print only words with repeating characters from an array. For example, the following code prints the whole array, but what if I only wanted it to print "hello" because it has a repeating character or any other words with repeating characters and not output words without repeating characters.
public class iterateThruArray
{
public static void main(String[] args)
{
String[] words = {"hello", "lmao", "why"};
int len = words.length;
for(int i = 0; i < len; i++)
{
String word = words[i];
//prints array words
System.out.println(word);
}
}
}