public enum PayEnum {
PAY_TYPE1(10, "微信支付"),
PAY_TYPE2(20, "支付宝");
private Integer id;
private String name;
PayEnum(Integer id, String name) {
this.id = id;
this.name = name;
}
}
System.out.println(PayEnum.PAY_TYPE1.name()); // 输出PAY_TYPE1
System.out.println(PayEnum.PAY_TYPE1.toString()); // 输出PAY_TYPE1
public enum PayEnum {
PAY_TYPE1(10, "微信支付"),
PAY_TYPE2(20, "支付宝");
private Integer id;
private String name;
PayEnum(Integer id, String name) {
this.id = id;
this.name = name;
}
public Integer getId() {
return this.id;
}
public String getName() {
return this.name;
}
}
System.out.println(PayEnum.PAY_TYPE2.getId());
System.out.println(PayEnum.PAY_TYPE2.getName());
public class test { public static void main(String[] args) { &...
java一个类可以有多个构造方法,根据传参类型和个数来匹配执行哪个构造方法。public class Member { public Member(){  ...
java stringBuffer(1).stringBuffer和stringBuilder区别stringBuffer是线程安全的,stringBuilder速度更快(2).简单的stringBuffer例子StringBuffer sBuffer = new&nb...
(1).java睡眠函数Thread.sleep(时间); //单位为毫秒(2).java睡眠函数例子Date dNow = new Date(); SimpleDateFormat ft = new&nbs...
pattern表示正则表达式,接收正则表达式作为参数例子:String content = "my name is gaojiufeng"; String pattern = "....
java正则表达式的捕获组捕获组可以将匹配到的结果根据正则中的括号进行分组,这里变量我加了$符,php转java的坏习惯,懒得改了,能跑就行// 匹配字符串 String $line = "gaojiufeng 1994! ok?...