I am trying to use the indexOf method to find if a char is in a word but since the char cannot be dereferenced i assumed it should be converted to a String i tried using these Methods but it does not seem to be comparing accurately - how should i be using a referenced char in 'indexOF'. here is my code, if this is a stupid problem with my code logic then i apologise
guess = JOptionPane.showInputDialog("Enter letter ").toUpperCase().charAt(0);
if((String.valueOf(guess)).indexOf(word.toUpperCase())>=0)
{
for(int k = 0; k<word.length(); k++)
{
if(guess==charwo[k])
{
charda[k]=charwo[k];
}
}
}
else
{
guesses = guesses-1;
System.out.println("guesses left "+guesses);
}