编程知识 cdmana.com

A collection of common Java errors

null Transbasic type

@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 Pointer exception 

To be continued ……

版权声明
本文为[eaglelihh.]所创,转载请带上原文链接,感谢

Scroll to Top