- public static void main(String[] args) {
- // TODO Auto-generated method stub
- String s = "1999-01-10";
- SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd",Locale.US);
- try {
- df.parse(s);
- } catch (ParseException e) {
- throw e;//错误
- //throw new ParseException(e);//错误
- //throw new RuntimeException(e); //正确
- }
- }
复制代码 1.上面 throw e;为什么不对呢!
2.throw new RuntimeException(e);和throw e不都是抛给上一级处理吗??
3.throw new ParseException(e);为什么也正确呢?? |
|