Hello guys,
I'm really new to
Java, only been learning it for a week and I've been reading through Head First Java. I'm on chapter 6 now and I wanted to try to make the DotCom game by myself (for those who haven't read the book, it's basically a Sink The Ship game on a 2d array). I Know I already have the code in the book, but I have written the code already and what isn't working in my code is that my code won't create an array of locations for the 3 "ships". And since you learn best at your own mistakes, I would be really happy if somebody would tell me what is wrong in my code. Also, ask any questions you have and sorry if this question is kinda stupid.
Here is the code for the method randoming 2 numbers from 1-5 and then converting it into a
string (A3 for example), randoming the direction number and then putting the three locations into an ArrayList array. The problem is, when I run the
test code for the method, the location array doesn't seem to be created as every guess returns a "miss".
Again, I haven't commented the code, but I tried to explain it in the question, so if you have any questions, I'd be happy to answer them.
Thank you very much,
Leon