Assuming the following enum declaration exists: Enum Dog { POODLE, BOXER, TERRIER } What will the following
Question:
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);
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Starting Out With Java From Control Structures Through Data Structures
ISBN: 9780133957051
6th Edition
Authors: Tony Gaddis
Question Posted: