Question: Assuming the following enum declaration exists: Enum Dog { POODLE, BOXER, TERRIER } What will the following statements display? a. System.out.println(Dog.POODLE + +

Assuming the following enum declaration exists: 

Enum Dog { POODLE, BOXER, TERRIER }

What will the following statements display?

a. System.out.println(Dog.POODLE + "\n" +
 Dog.BOXER + "\n" +
 Dog.TERRIER);
b. System.out.println(Dog.POODLE.ordinal() + "\n” +
 Dog.BOXER.ordinal() + "\n" +
 Dog.TERRIER.ordinal());
c. Dog myDog = Dog.BOXER;
If (myDog.compareTo(Dog.TERRIER) > 0)
 System.out.println(myDog + " is greater than " +
 Dog.TERRIER);
Else
 System.out.println(myDog + " is NOT greater than " +
 Dog.TERRIER);

Step by Step Solution

3.29 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a SystemoutprintlnDogPOODLE DogBOXER DogTERRIER b Systemoutprintl... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Starting Out With Java From Control Structures Questions!