Page 893 - AP Computer Science A, 7th edition
P. 893

5. (A) The expression
(int) (Math.random() ∗ 50);
returns an int from 0 to 49. Therefore, adding 1 shifts the range to be 1 to 50, which was required.
































































































   891   892   893   894   895