简体   繁体   English

是否有一个快捷方式可以在Eclipse中为方法签名添加异常?

[英]Is there a shortcut to add exceptions to a method signature in Eclipse?

I am using the Eclipse IDE for Java and I want to know if there is shortcut to add exceptions in a method signature. 我正在使用Eclipse IDE for Java,我想知道是否有在方法签名中添加异常的快捷方式。 Like if I am writing a method and I used bufferedreader.readline() , is there a shortcut to add the declaration throws IOException instead of writing it myself . 就像我正在编写一个方法并且我使用bufferedreader.readline() ,是否有一个添加声明的快捷方式throws IOException而不是自己编写它。

When you hover your mouse over the statement, you will get the below popup. 当您将鼠标悬停在语句上时,您将看到以下弹出窗口。 You just have to click on the Add throws declaration link 您只需单击Add throws declaration链接即可

当你将鼠标悬停在有问题的陈述上时

You can also press Ctrl+1 for a similar popup, when your keyboard cursor is on the statement line. 当键盘光标位于语句行上时,您也可以按Ctrl+1进行类似的弹出窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM