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();
}