标签:string static www 写代码 指针 col 空指针异常 return .com
Checked : 你可以在写代码的时候就throw 或者try catch 的
Unchecked : Error + RuntimeException 。提前无法预测的
http://www.cnblogs.com/shihuc/p/5201905.html
NUllpointerException一个例子:不一定要去捕获空指针异常
(2)访问或修改 null 对象的字段。
class Point {
public int x, y;
public int getX() {
return x;
}
}
public class TestNullPointerException {
static Point p1;
public static void main(String args[]){
p1.x = 1; // 此处抛出NullPointerException
}
}
标签:string static www 写代码 指针 col 空指针异常 return .com
原文地址:http://www.cnblogs.com/x-guozheng/p/7641699.html