代碼中經常須要定義一些常量,若是直接寫不太規範,代碼太亂,咱們須要對這些常量進行統一管理===》常量類spa
package cn.ma.sync.utils; /** * 公司:馬氏集團 * 文件名:Constants * 做者: 20190915 * 時間: 2019/10/20 18:08 * 描述: 常量類 */ public class Constants { /** * 分頁查詢params的key值 page(頁碼) */ public static final String PAGE_SIZE = "page"; /** * 分頁當前頁碼 */ public static final String PAGE_NO = "pageNo"; /** * 參數有誤提示 */ public static final String CHECK_PARA = "參數有誤,請覈實!"; }
2. 常量與枚舉 對比.net