June 2017
Beginner
1296 pages
69h 23m
English
... that contained multiple instances of class Craps, they’d all share this one SecureRandom object.
main’s Local VariablesThe game is reasonably involved. The player may win or lose on the first roll, or may win or lose on any subsequent roll. Method main (lines 20–66) uses
local variable myPoint (line 21) to store the “point” if the player doesn’t win or lose on the first roll,
local variable gameStatus (line 22) to keep track of the overall game status and
local variable sumOfDice (line 24) to hold the sum of the dice for the most recent roll.
Variable myPoint is initialized to 0 to ensure that the application will compile. If you do not initialize myPoint, the compiler issues an error, because myPoint is not assigned a value in ...
Read now
Unlock full access