This is an example from a book to explain using the WhoWins type for three possibilities.
But when I go to compile, I get the error, "cannot find symbol - class WhoWins". Any suggestions? Thanks

import java.util.Scanner;
import static java.lang.System.out;

class Scoreboard {

public static void main(String args[]) {
Scanner myScanner = new Scanner(;
int hankees, socks;
WhoWins who;

out.print("Hankees and Socks scores? ");
hankees = myScanner.nextInt();
socks = myScanner.nextInt();

if (hankees > socks) {
who = WhoWins.home;
out.println("The Hankees win :-)");
} else if (socks > hankees) {
who = WhoWins.visitor;
out.println("The Socks win :-(");
} else {
who = WhoWins.neither;
out.println("It’s a tie :-|");

out.println("Today’s game is brought to you by");
out.println("SnitSoft, the number one software");
out.println("vendor in the Hankeeville area.");
out.println("SnitSoft is featured proudly in");
out.println("Chapter 6. And remember, four out");
out.println("of five doctors recommend SnitSoft");
out.println("to their patients.");

if (who == WhoWins.home) {
out.println("We beat ‘em good. Didn’t we?");
if (who == WhoWins.visitor) {
out.println("The umpire made an unfair call.");
if (who == WhoWins.neither) {
out.println("The game goes into overtime.");

Well, you will need that class... It's not going to appear out of thin air, so you will have to write it (though I presume this is part of some example, which means it will be there somewhere else in the example).

This article has been dead for over six months. Start a new discussion instead.