The result -1 is returned when the character sought isn't found. Why might that be happening, especially on the first letter? You can fix that yourself.
Type: Posts; User: GregBrannon
The result -1 is returned when the character sought isn't found. Why might that be happening, especially on the first letter? You can fix that yourself.
Yes, the StringBuilder.setCharAt() method requires an ( int, char ) as parameters - you can read this yourself in the API. In your method, guessedChar is passed as a String, so you need to either:
...
I added code tags to your post. You can edit the post and see what I did so that you can do that in the future OR read this link to get that and other info useful for newcomers.
Looking at the...
Show the code you tried, describe wha "didn't work," post any errors you want help with, and ask specific questions. We can't do it for you, but we can help you with code you've written.
Can you describe how you'd do it in plain language? Something like:
Find location of guessChar in englishWord and change that same location in secretWord from an asterisk to the guessChar.
Try...