本帖最后由 王家胜 于 2013-12-6 13:05 编辑
- enum Ps
- {
- COMMON, EXPRESS, VIP,SHow(new Long(4),Ps.VIP,"战三");
- int arg=0;
- private Long id;
- private Ps ps;
- private String name;
- private Ps()
- {
- arg=0;
- }
- private Ps(Long id,Ps ps,String name)
- {
- arg=3;
- this.id=id;
- this.ps=ps;
- this.name=name;
- }
- public String toString()
- {
- if(arg==0)
- {
- return super.toString();
- }
- if(arg==3)
- return show();
- else
- return "未定义";
- }
- public String show()
- {
- return "序号:"+Ps.valueOf(Ps.class, ps.toString()).ordinal()+ "\t编号:"+this.id+"\t类型:"+this.ps +"\t名称:"+this.name+"\n";
- }
- }
- public class MainStart
- {
- public static void main(String[] args)
- {
- Ps ps=Ps.SHow;
- System.out.println(ps);
-
- }
- }
复制代码 |