Hi,
I am new to
Java and trying to learn java from Head First book chapter 5, In this book code has written to create simple dotcom game. Basically it is doing following
1. Create grid of simple array
2. Assign 3 continous locations in a array
3. Accept guess from user
4. If location allocated = guess then give message "hit" otherwise miss and accept another guess from prompt
4. If all locations = guesses then give message "kill". otherwise loop and accept guess from user.
...etc
In one of the places it is doing
int guess = Integer.parseInt(stringGuess);
I have not understood the purpose of converting
string to numbers ?
My understanding is that it is accepting "guess" from prompt and which will be always integer, so to convert from strings to integer it requres parseInt.
Pl help me in my understandings.
thanks & regards
java-boy