Hello, i have came across a problem when trying to create a hangman game.
I want to read a String of letters inputed from keyboard and then i want someone else to guess this word(typical hangman rules). I have used this code.
InputStreamReader FindWord = new InputStreamReader(System.in); BufferedReader in = new BufferedReader(FindWord); String letter = aLetter.getText(); FindWord.indexOf(letter); int charPos = FindWord.indexOf(letter); if (charPos == 0) Char1.setText(letter); if (charPos == 1) Char2.setText(letter); if (charPos == 2) Char3.setText(letter); if (charPos == 3) Char4.setText(letter); if (charPos == 4) Char5.setText(letter); if (charPos == 5) Char6.setText(letter); FindWord.indexOf(letter, charPos+1);
The problem is that its says that
"can not find symbol
symbol: method indexof(java lang string)
location: class java io input stream reader"
hmmm i'm not really sure how to overcome this problem, could you suggest solution for that ??