shortcut to add throws declaration in Intellij Idea

When a piece of code needs error handling, IntelliJ underlines it with red. Set your pointer on that piece of code and press ALT+ENTER. IntelliJ should now give you the choice to either surround it with try/catch, add a catch clause, or to add a throws declaration.

In your case: click the underlined code → ALT+ENTER → Add Exception to Method Signature

IntelliJ also has a shortcut to place your cursor on the next error or warning: F2. This – especially in combination with ALT+ENTER – is quite useful.

posted @ 2019-11-20 17:15  kakaisgood  阅读(267)  评论(0编辑  收藏  举报