用于IntelliJ中的java8的System.out :: println的热键

时间:2017-10-29 23:40:14

标签: intellij-idea

对于System.out::printlnsoutSystem.out.println()的{​​{1}}是否有热键?

如果没有,如何在intelliJ中为java8创建System.out::println的热键?

2 个答案:

答案 0 :(得分:3)

尝试添加一些hotkeys以使我们的开发更快,这是很常见的。 IntelliJ通过模板为我们提供了此配置。

为此,您可以转到Preferences > Editor > Live Templates选择output,然后点击+按钮并输入以下配置:

  • 缩写:sout8
  • 说明:Prints in Java 8
  • 模板文字:System.out::println
  • 适用于:Java: statement, expression

点击ApplyOK按钮。

因此,当您编写代码时,您只能在句子和表达式中使用热键sout8,您可以在选项Applicable in

中修改此行为

enter image description here

答案 1 :(得分:0)

之前的答案是正确的,此外,您还需要定义用例,即Application in Java: statement, expression

enter image description here

现在,你应该好好去

enter image description here

相关问题