Skip to content

Commit 1b71ae0

Browse files
空指针异常
1 parent e63d320 commit 1b71ae0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/CException/NullException.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package CException;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
/**
7+
* @ClassName NullException
8+
* @Description
9+
* @Author yuzhihua
10+
* @Date 2022/4/20 9:17
11+
* @Version 1.0.0
12+
**/
13+
public class NullException {
14+
public static void main(String[] args) {
15+
List<Long> idList=new ArrayList<>();
16+
idList=null;
17+
for(Long id:idList){
18+
System.out.println(id);
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)