Question: Write your answers in a text file and submit your file below. P1: Look at the following declaration: enum Color { RED, ORANGE, GREEN, BLUE)

Write your answers in a text file and submit your file below. P1: Look at the following declaration: enum Color { RED, ORANGE, GREEN, BLUE) a. What is the name of the data type declared by this statement? b. What are the enum constants for this type? c. Write a statement that defines a variable of this type and initializes it with a valid value. P2: Assuming the following enum declaration exists: enum Dog {POODLE, BOXER, TERRIER}. What will the following statements display? a. System. out. println(Dog. POODLE + " "+ Dog. BOXER +" " + Dog. TERRIER): b. System. out. println(Dog. POODLE. Ordinal() + " + Dog. BOXER. Ordinal() "In"+ 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
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
