public enum BusinessMsgType {
        BUSINESSMSG_JOIN,
        BUSINESSMSG_QUIT,
        BUSINESSMSG_SCHEDULE,
        BUSINESSMSG_TASK
    };

 

1. int 转化 enum

int type = 0;

BusinessMsgType msgType = BusinessMsgType.values()[type];

2. enum 转化 int

BusinessMsgType msgType = BusinessMsgType.BUSINESSMSG_JOIN;

int type = msgType.value.ordinal();

相关文章:

  • 2021-08-04
  • 2021-10-12
  • 2022-02-28
  • 2022-12-23
  • 2022-01-07
  • 2021-12-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-29
  • 2022-12-23
  • 2021-06-03
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案