Java JDK 6学习笔记 教学课件 作者 978 7 302 14995 8 第11章.pptVIP

  • 0
  • 0
  • 约5.2千字
  • 约 18页
  • 2017-08-19 发布于广东
  • 举报

Java JDK 6学习笔记 教学课件 作者 978 7 302 14995 8 第11章.ppt

* * * * * 第11章 列举型态 常数设置与列举型态 定义列举型态 常数设置 可使用接口来定义操作时所需的共享常数 public interface ActionConstants { public static final int TURN_LEFT = 1; public static final int TURN_RIGHT = 2; public static final int SHOT = 3; } 常数设置 public void someMethod() { .... doAction(ActionConstants.TURN_RIGHT); .... } public void doAction(int action) { switch(action) { case ActionConstants.TURN_LEFT: System.out.println(向左转); break; case ActionConstants.TURN_RIGHT: System.out.println(向右转); break; case ActionCon

文档评论(0)

1亿VIP精品文档

相关文档