thanks for your help so far i just have one last thing as i found the problem and have worked on my code. I can't get my remaining guesses to work properly, i have it set to take 1 off when the...
Type: Posts; User: pikapo0
thanks for your help so far i just have one last thing as i found the problem and have worked on my code. I can't get my remaining guesses to work properly, i have it set to take 1 off when the...
ohh wait i found the problem my word is printing as nothing so ill look for why it is nothing.
word is a six letter word from a random list and userLetter is an input between a-z and i've being trying each and every letter
I put prints for variables and other things in between the for and if statements and they dont print so it has something to do with the following for loop?
for(int l = 0; l< word.length();...
Uhm it doesn't execute that chunk of code by the looks of it, it just skips right by it like it doesn't exist?
--- Update ---
This is my entire code so far:
/* Author: Brendon Drury
*...
thanks for that. but know my program just ends when i get to that point so idk.
So what would i write as the method then?
The length of word is always 6 and when i try use word.length it gives me an error saying cant find symbol: variable length for this :
for(int i = 0; i< word.length; i++){
...
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:686)
at Hangman.userGuess(Hangman.java:130)
at Hangman.main(Hangman.java:39)
at...
Even that still gives me the error. I'm wondering if it has anything to do with variable "i" being automatically bigger than my word before it can run through?
I'm getting an error i really don't know why:
ERROR:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown...