java中枚举在游戏开发中作用
2017-06-28 14:06
127 查看
package com.hai.tao; public enum Color { REDD("红色", 11), GREENN("绿色", 22), BLUEE("白色", 33), YELLOO("黄色", 44); private String name; private int index; private Color(String name, int index) { this.name = name; this.index = index; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } }
package com.hai.tao; public class test { /** * @param args */ public static void main(String[] args) { // 遍历所有的枚举 for (Color color : Color.values()) { System.out.println(color + " " + color.getName() + " " + color.getIndex()); } } }
java中的枚举在多人在线游戏后台开发中扮演什么角色昵?
回答是,通常用于消息处理器类的注册
FR:徐海涛(Hunk Xu)
相关文章推荐
- 浅谈在Java开发中的枚举的作用和用法
- 浅谈在Java开发中的枚举的作用和用法
- 浅谈在Java开发中的枚举的作用和用法
- 浅谈在Java开发中的枚举的作用和用法
- Java开发中的枚举的作用和用法
- 浅谈java开发中的枚举的作用和用法
- 人生如梦游戏间,RPG游戏开源开发讲座(JAVA篇)[4]——一步莲华
- 人生如梦游戏间,RPG游戏开源开发讲座(JAVA篇)[0]——月晕础润
- java基础,游戏开发知识
- 网络在线游戏开发心得(服务器端、Java)
- 人生如梦游戏间,RPG游戏开源开发讲座(JAVA篇)[3]——邯郸学步
- JAVA开发的华容道游戏
- 人生如梦游戏间,RPG游戏开源开发讲座(JAVA篇)[0]——月晕础润
- [转]Java可以拿來开发游戏吗?
- 人生如梦游戏间,RPG游戏开源开发讲座(JAVA篇)[2]——踏破红尘
- 人生如梦游戏间,RPG游戏开源开发讲座(JAVA篇)[3]——邯郸学步
- 人生如梦游戏间,RPG游戏开源开发讲座(JAVA篇)[1]——风云初现
- 利用Java Swing 实现游戏开发
- Java 游戏开发Notes
- Java游戏开发之一