Because you are out of range obviously. you cannot substring from end of string.
for(int i=0;i<wordToGuess.length();i++)
{
if(theGuess.equals(wordToGuess.substring(i,i+1)))
{
correctLetters[i]=theGuess;
matches=true;
numCorrect++;
}
}
Fastest way to find out is to debug the app