Mastering Java: The Ultimate Quiz for 'Thinking in Java

1 / 510

What is returned by the 'compete()' method in the 'RoShamBo' example?

An integer indicating the result

An enum instance NEW, LOSE, or DRAW

An enum instance WIN, LOSE, or DRAW

The 'compete()' method in the 'RoShamBo' example returns an enum instance indicating whether the player won, lost, or tied the game. Option A is incorrect because it suggests that an integer value is returned, which would not make sense for a game that has more than two possible outcomes. Option B is also incorrect because the 'ROCK, PAPER, SCISSORS' enum is used to represent the choices, not the result. Option D is incorrect because a boolean value would not be able to accurately represent all the possible outcomes in the game. Therefore, option C is the correct and most logical answer.

Get further explanation with Examzify DeepDiveBeta

A boolean value

Next Question
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy