This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
hello there im just starting java and really programming in general, but i am going through the head first java book, and i am having trouble with one of the exercises, i have spent at least an hour typing and retyping this code and checking it against the book, but i cannot find whats causing the error, this is the exact code i am using(below) and it return this error every time i try and compile it:
any advice on how to fix this would be much appreciated, thank you
Edit: Sorry, did not think about the copyright issue (code deleted) [ August 09, 2008: Message edited by: sam ]
Here you are trying to call the setLocationCells method giving an int array as the needed parameter when the method setLocationCells only takes ArrayList<String>
I have the book ill go look at the code and see what you done wrong.
Edit found the problem: The first class you have there is for the first simple dot com game the book does before you learn about Arraylists the second class comes from the full game which the book does after that. You are simple mixing the classes up. Also the code in the book is copyright protected so you are not supposed to post it on the forum.
[ August 09, 2008: Message edited by: alex barfoot ] [ August 09, 2008: Message edited by: alex barfoot ]
Please check your private messages for an important administrative message from the staff.
Thanks, Katrina JavaRanch Saloon Bartender
Joined: Aug 09, 2008
alright sorry about that just did not think they would give that code and not tell you need to edit more code to make it work, i did think about the fact that we had an int array trying to be fed into a String arraylist, i just assumed you could read an array into an arraylist of the same type so i tried changing the arraylist to type int, and that's as far as i got, thanks a lot for the help though [ August 09, 2008: Message edited by: sam ]