java错误和异常

来源:互联网 发布:js遍历特定标签 编辑:程序博客网 时间:2024/05/16 13:03

错误:error:非常严重;不处理无法编译;不过很容易处理;一般也就是变量名错误,函数写错了这些;还有就是内存;环境问题了

异常:Exception:编译时异常;必须使用try..catch才能运行;比如IOException,SQLException;

        RuntimeException:运行时异常:就是通过编译了;但是运行过程中就异常了,比如:nullpointexception,IndexOutOfBoundsException

       可以用try...catch错误;

0 0
原创粉丝点击