zoukankan      html  css  js  c++  java
  • java枚举使用

    1.开发中如何使用枚举,一般在开发中使用消息提示。枚举可以继承,实现接口等。
    public enum Result { SUCCESS(1,"201 ok") { @Override void doCallBack(String msg) { System.out.println("201 success process!!!" + " " + msg); } }, ERROR(2,"501 server error") { @Override void doCallBack(String msg) { System.out.println("server error process !!!" + " " + msg); } }, FAIRL(3,"javascript error") { @Override void doCallBack(String msg) { System.out.println("javascript error process!!!" + " " + msg); } }; private int code; private String msg; abstract void doCallBack(String msg); Result(int code,String msg){ this.code = code; this.msg = msg; } public static void main(String[] args) { Result v = Result.ERROR; v.doCallBack(v.msg); } }

      

  • 相关阅读:
    模板
    洛谷
    Codeforces
    Codeforces
    Codeforces
    Codeforces
    洛谷
    洛谷
    洛谷
    NOIP 普及组 2016 海港
  • 原文地址:https://www.cnblogs.com/gstsyyb/p/5080595.html
Copyright © 2011-2022 走看看