当前位置:网站首页>@nonnull annotation of Lombok
@nonnull annotation of Lombok
2022-06-21 06:50:00 【y_ bccl27】
1. Why use @NonNull
NullPointerException Null pointer exception ( Be commonly called NPE abnormal ) It can be said that every developer has encountered a common exception , Even experienced veterans , I also write when I am not careful NPE Of bug. Pointer exists only in C In language ,Java There is no pointer in , A null pointer is a null reference ,Java The null pointer exception is that the reference itself is null , But called the method , At this time, a null pointer exception will appear . Member variables and methods belong to objects ( Remove static ), There are corresponding member variables and methods in the object , Then call these member variables and methods through objects . For null pointers , It doesn't point to any object , There are no so-called member variables and methods , At this time, use it to call some properties and methods , A null pointer exception will occur .
Construct a Student class , And create a full parameter constructor :
package com.bc.model;
public class Student {
private String name;
private Integer age;
public Student(String name, Integer age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer 边栏推荐
- 【MySQL】数据库多表操作通关教程(外键约束、多表联合查询)
- 5254. dynamic planning of selling wood blocks
- 创新项目实训:数据爬取
- Course design of simulated bank deposit and withdrawal management system in C language (pure C language version)
- 数据库有用户更改密码问题
- [notes for personal use] detailed steps for connecting MyEclipse to MySQL database
- 出现ConcurrentModificationException这个异常报错,怎么处理?
- Summary of each layer of the five layer reference model
- File类的构造方法和各种常用的方法
- Pyg tutorial (6): customizing the messaging network
猜你喜欢
随机推荐
Zongzi battle - guess who can win
leetcode数据库mysql题目(难度:简单)
Lnc2meth: methylation sites on disease-related lncrna
5254. dynamic planning of selling wood blocks
(各种规律数的编程练习)输出范围内的素数,一个整数的分解质因数,两个数的最大公约数和最小公倍数以及水仙花数和完数等等
Argo CD usage
Tweenmax irregular geometry background with animation JS effect
第4篇:从硬件/源码视角看JVM内存模型
[middle order traversal of binary tree based on stack] middle order traversal of binary tree + stack, spatial complexity of O (H)
Pyg tutorial (1): getting to know pytorch geometry
第13期:Flink零基础学习路线
产品经理精通Axure工具篇
Markdown mathematical grammar [detailed summary]
C语言程序设计——三子棋(学期小作业)
PyG教程(5):剖析GNN中的消息传播机制
第7期:内卷和躺平,你怎么选
关于#mysql#的问题,如何解决?
Pyg tutorial (2): graph data
[JS] intercepting string
Issue 12: Spark zero foundation learning route








