I create a version of yahtzee using java. I created a dice class to store random arrays of dice that would be generated for every new game. I also had a yahtzze class that was used to get the user's input and then display a message or preform an action based on that import. I used the scanner module to do that. The way my game worked was it would display a random array of dice numbers to the player, and the player would type in either a 3 to roll all the dice again. They player could also type in a 1 corresponding with the index of the die that they wanted to roll again, or a 0 corresponding with the index of the die that the player wanted to keep.
Yahtzee test class that calls the start game method
class that displays the random array of dice
class that reacts to the user input