Enum Skeleton Table

80 Views Asked by At

Hello I'm just wondering if there is anyone that could make sense of this java skeleton code table for an enum class. Table:

enter image description here

My code currently is this:

public enum SkyCondition
{
    SUNNY,
    SNOWY,
    CLOUDY,
    RAINY
}

Is that it? or am I supposed to incorporate the int in some way? Thank you.

1

There are 1 best solutions below

1
Nowhere Man On BEST ANSWER

Every enum includes two properties by default:

public final String name(); // name like SUNNY, SNOWY, CLOUDY, RAINY
public final int ordinal(); // the position in enum declaration: 0 - for SUNNY, 1 - SNOWY, etc.

so, int is already incorporated into enum.