Java Enum return Int

前端 未结 8 2036
小鲜肉
小鲜肉 2020-12-13 03:31

I\'m having trouble declaring an enum. What I\'m trying to create is an enum for a \'DownloadType\', where there are 3 download types (AUDIO, VIDEO, AUDIO_AND_VIDEO).

<
8条回答
  •  没有蜡笔的小新
    2020-12-13 03:55

    Do you want to this code?

    public static enum FieldIndex {
        HDB_TRX_ID,     //TRX ID
        HDB_SYS_ID      //SYSTEM ID
    }
    
    public String print(ArrayList itemName){
        return itemName.get(FieldIndex.HDB_TRX_ID.ordinal());
    }
    

提交回复
热议问题