少年阿宾

那些青春的岁月

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks
package com.abin.lee.collection.enumer;
public class ChangeType {
public static enum stype{
CHINA("china"),JAPAN("japan"),GERMAN("german");
private String textVal;
private stype(String textVal){
this.textVal=textVal;
}
public String toString(){
return textVal;
}
}
public static void main(String[] args) {
String abin=stype.CHINA.toString();
System.out.println(abin);
stype abing=stype.valueOf("CHINA");//注意这里不应该传china、japan、german,必须传CHINA,JAPAN,GERMAN
System.out.println("abing="+abing);
}
}
posted on 2012-09-02 15:46 abin 阅读(390) 评论(0)  编辑  收藏 所属分类: JavaEnum

只有注册用户登录后才能发表评论。


网站导航: