@Data
@NoArgsConstructor
@AllArgsConstructor
static class OneClass {
private Double value;
}
@Test
public void nullToPrimitive() {
OneClass oneClass = new OneClass(1.0);
double value = oneClass.getValue();
System.out.println(value);
OneClass oneClass2 = new OneClass();
value = oneClass2.getValue();
System.out.println(value);
}
null指针异常
原文:https://www.cnblogs.com/eaglelihh/p/13960467.html