6
在IntelliJ IDEA中,我可以按下「Surround與」快捷方式CTRL-ALT-T
以使用try/catch塊包圍代碼塊等等。在IntelliJ IDEA中,如何用try-with-resources包圍?
我想資源的一部分環繞成一試,與資源塊:
Writer out = Writer out = Files.newBufferedWriter(destination, StandardCharsets.UTF_8);
temp.process(model, out);
要這樣:
try (Writer out = Files.newBufferedWriter(destination, StandardCharsets.UTF_8)) {
temp.process(model, out);
}
不過,按下CTRL-ALT-T
當此選項不可用。
如何用try-with-resources塊來包圍代碼塊?