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
a SystemoutprintlnDogPOODLE DogBOXER DogTERRIER b Systemoutprintl... View full answer
Get step-by-step solutions from verified subject matter experts
