Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1708402
  • 博文数量: 171
  • 博客积分: 11553
  • 博客等级: 上将
  • 技术积分: 3986
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-25 20:28
文章分类

全部博文(171)

文章存档

2012年(2)

2011年(70)

2010年(9)

2009年(14)

2008年(76)

分类: Java

2008-08-10 22:53:53

1.1. 枚举类型

 代码

/*

 * To change this template, choose Tools | Templates

 * and open the template in the editor.

 */

 

package javatutorials;

 

/**

 *

 * @author wanpor

 */

enum Month{

    Jan,

    Feb,

    Mar,

    Apr,

    May,

    Jun,

    Jul,

    Aug,

    Sep,

    Oct,

    Nov,

    Dec,

  

}

public class EnumClass {

    static final int MONTH_LEN = 12;

    static Month month = Month.Jan;

    public static void main(String[] args){

            System.out.println(month);

    }

 

}

说明

1.       枚举类型的定义;

2.       枚举类型的初始化

3.       不可以转化为int类型

文件:EnumClass.zip
大小:0KB
下载:下载
阅读(1394) | 评论(0) | 转发(0) |
0

上一篇:Java内嵌类

下一篇:Java接口

给主人留下些什么吧!~~