Introduce Assertion 这个需要和卫语句进行区分,卫语句一般会给出一个默认值,或者直接返回,断言是不满足条件直接返回异常 所以断言适合,检查参数 例子 public static void main(String[] args) { Integer i = null; Assert.notNull(i,"param i can't be null"); //normal logic }