BEGIN;
验证代码如下:
public static void main(String[] args) {
Long id = null;
System.out.println(test1(id));
System.out.println(test2(id));
System.out.println(test3(id));
System.out.println(test4(id));
}
private static String test1(Long id) {
try {
if(0 == id || null == id) return “test1 --> 判断代码成功。”;
else return “test1 --> 判断代码错误!”;
} catch (Exception e) {
return “test1 --> Exception”;
}
}
private static String test2(Long id) {
try {
if(id == 0 || null == id) return “test2 --> 判断代码成功。”;
else return “test2 --> 判断代码错误!”;
} catch (Exception e) {
return “test2 --> Exception”;
}
}
private static String test3(Long id) {
try {
if(null