Question: Assume that the following enumerated data type has been declared: Enum Letters { Z, Y, X } What will the following code display? If (Letters.Z.compareTo(Letters.X)

Assume that the following enumerated data type has been declared: 

Enum Letters { Z, Y, X }

What will the following code display? 

If (Letters.Z.compareTo(Letters.X) > 0)
 System.out.println("Z is greater than X.");
Else
 System.out.println("Z is not greater than X."); 

Step by Step Solution

3.41 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Solution The following code will display Z is not ... 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!