一、整形常量支持下划线
二、多异常的写法
public static void main(String[] args) {
String aa = null;
int a = 1_2;//整形常量支持下划线
try {
boolean f=aa.equals("");
a = Integer.parseInt(aa);
System.out.println(a);
} catch (NumberFormatException|NullPointerException e) {//多异常的写法
e.printStackTrace();
}
}
三、switch中可以使用字串
String s = "test";
switch (s) {
case "test" :
System.out.println("test");
case "test1" :
System.out.println("test1");
break ;
default :
System.out.println("break");
break ;
}
四、TWR
五、钻石语法
Map<Integer, Map<String , String >> users=new HashMap<Integer, Map<String , String >>();
Map<Integer, Map<String , String >> users1=new HashMap<>();
六、简化变参方法调用