1.java默认是不开启断言的
public static void main(String[] args) {
int x = 5;
assert x > 10 : "x should max than 10";
System.out.println("result");
}
2.开启
Idea VM options: -ea: 报名.类名
1.java默认是不开启断言的
public static void main(String[] args) {
int x = 5;
assert x > 10 : "x should max than 10";
System.out.println("result");
}
2.开启
Idea VM options: -ea: 报名.类名
本文标题:断言
本文链接:https://www.haomeiwen.com/subject/mgucaqtx.html
网友评论