Discuss / Java / 没有头绪

没有头绪

Topic source

第一次修改,catch 里我写的是IOException类型,编译运行后,IDE 抛出以下异常我才知道构造catch时类型是 NumberFormatException。怎么才能在不编译运行时就知道要 catch哪些类型的异常呢?

Exception in thread "main" java.lang.NumberFormatException: For input string: "x9"

相同问题的同学请看下一章。

#3 Created at ... [Delete] [Delete and Lock User]

Ctrl+鼠标左键 点击 需要检查异常的方法,里面会有类似于 throws NumberFormatException 可以知道他会抛出NumberFormatException异常

🌙

#4 Created at ... [Delete] [Delete and Lock User]

看源码,或者直接exception


  • 1

Reply