Hello readers!
After hours of working on this code, I really can not understand what "findWithinHorizon..." does. Well I understand that it looks for a character based on what you typed in "charAt(number);". So far so good. But the problem is, it acts really, really strange. I have a code, not too long that I've been working with for a while now, it is very simple, but still complicated for me since I'm a beginner.
First of all, the program needs to scan 2 lines in order for it to move on, which has probably something to do with 2 scanner being called (letter and
word one). The point of this program is simple, it scans for a word typed by the user. The program grabs a random letter in that word and then requires the user to type the correct letter in the command box. So the issue is, as mentioned just now, it needs to scan twice, so I have to type two lines. Second of all, it only works with words being 2 or less letters long, if I try something with 3 letters it returns:
Hello, please type any word.
fff
fff
Exception in
thread "main" java.lang.StringIndexOutOfBoundsException:
String index out of range: 1
at java.lang.String.charAt(Unknown Source)
at Default.Horizon.main(Horizon.java:27)
Picked up _JAVA_OPTIONS: -Xmx512M (what is this anyways?)
I hope this wasn't too much bother-some for you to read, any help greatly appreciated, thanks!