Below is a method i am using which contains a for loop. it loops through the words in the array and if the input doesnt match one of the strings in the array, it throws an exception, well thats the idea anyway. But it is throwing the exception when it gets a match, as well as not getting a match... Any help would be greatly appreciated
public static void englishWordExist(String input) throws WordDoesntExistException
{
for (int x=0; x<englishWords.length; x++)
{
if (input.equals(englishWords[x]))
{
Assignment2GUI.outputLabel.setText(irishWords[x]);
}
else
{
throw new WordDoesntExistException("This Word Is Not In The Dictionary");
}
}
}
}