3 questions

Sorry I put so many questions in my previous post "Thinking in Java book questions" , I realized it was too much to ask the forum to answer all of them. So I Googled them, and solved most of my questions myself, but I am still lost on 3. Please if anyone can help it would be really appreciated. Thanks.

question 1

page 137 of Thinking in Java

why would a method have both "print(result + ", ");" and "return result;" in the same method right next to each other, don't I just need "return result"?

It's hard to answer without having read the book myself, but I'll take a shot at it.

A) One prints to the console, the other returns the value to use in the method that called it.

B) Yes. char is a 16-bit value that is used to describe characters. For instance, the character "a" has a value of 97.

C) My guess is that that code randomly selects a character. As described above, all characters have a numerical representation, and there are 26 characters in the English language. What the code says is "Pick a random number between 0 and 26, and pick the character that's that many steps from the character "a".

[B]Content Encoding Error[/B]
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
Please contact the website owners to inform them of this problem.

It may be worth knowing that ASCII in Java is a subset of the UNICODE standard, and while the ASCII alphabet encoding is sequential and contiguous, that is not necessarily the case with other UNICODE alphabet encodings, so calculating letter offsets that way is not best practice for multi-lingual applications.