the program i'm trying to make is thus: a program that makes three letter words in format from letters input by user. The same letter cannot be used more than once unless the user has used it more than once, and the same word cannot appear twice.
public class JavaApplication1 {
private static boolean Vowel (char c){
return (c == 'a' || c == 'e' || c == 'o' || c == 'u' || c == 'i');
}
public static void main(String[] args) {
char[] array = {'b', 'c','a', 'd', 'e', 'b'};
//List<Character> chars = new ArrayList<Character>();
String words = "";
for(int i = 0; i < array.length; i++){
if(Vowel(array[i]) == true){
continue;
}
for(int j = 0; j < array.length; j++){
if(Vowel(array[j]) == false){
continue;
}
for(int k = 0; k < array.length; k++){
if(Vowel(array[k]) == true){
continue;
}
if(array[k] == array[i]){
continue;
}
else{//here it should check if the word already exists
if(chars.contains((array[i] + array[j] + array[k]))){
continue;
}
else{
chars.add(array[i]);
chars.add(array[j]);
chars.add(array[k]);
}
}
}
}
}
System.out.print(chars.toString());
}
}
The place I have trouble is ... checking if the word already exists. I've tried using Array lists strings, char array. (array[i]+array[j]+array[k]) seem to be perceived as a INT for some reason.