public class TestBooleanNull { public static void main(String[] args) { if (test()) { System.out.println("1232"); } } /** * java.lang.Boolean是对象,可以为null。但null作为if的条件会报npe * @return */ private static Boolean test() { return null; } }
public class TestBooleanNull { public static void main(String[] args) { if (test()) { System.out.println("1232"); } } /** * java.lang.Boolean是对象,可以为null。但null作为if的条件会报npe * @return */ private static Boolean test() { return null; } }
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。