Java: primitive type 可以为 null
Boolean b = null;
boolean b2 = b;
System.out.println(b2); // null
所以不要以为 boolean 是非黑即白;int/Integer 等 primitive type 同理
Boolean b = null;
boolean b2 = b;
System.out.println(b2); // null
所以不要以为 boolean 是非黑即白;int/Integer 等 primitive type 同理
留下评论