enumeration学习

import org.junit.Test;
public class enumeration {
@Test
public void test() {
System.out.print(School.name+"--> ");
System.out.print(School.name.getvalue()+" :");
System.out.println(School.name.info());
}
}
enum School {
name("名字") {
public String info() {
return "小杰";
}
},
location("地址") {
public String info() {
return "天津";
}
};
private String value;
private School(String value) {
this.value = value;
}

public String getvalue() {
return this.value;
}
public abstract String info();
}

 

posted @ 2012-12-09 15:29  Earic  阅读(173)  评论(0编辑  收藏  举报