when typing the shortcut 'sout' tab i sometimes get println and sometimes printlf
已回答
Why is this?
I type sout<tab> and it gives me sometimes:
System.out.println()
but then i try it again and it give me:
System.out.printf()
why is this?
请先登录再写评论。
Hi.
"sout" should result in "System.out.println();", "souf" in "System.out.printf("");"
Could you please provide screen recording of the problem?
When I type sout and hit the tab key it inserts a tab in the editor. I'm doing this in a Java source file. The live template is there and is enabled. I'm using:
IntelliJ IDEA 2019.1.2 (Ultimate Edition)
Build #IU-191.7141.44, built on May 7, 2019
JRE: 1.8.0_202-release-1483-b49 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
Make sure you are inside the method where this completion makes sense, not just inside the class.
I had the same problem but "sout" only worked inside a method definition and not insidet the defined class itself thanks to Mr Baranov's suggestion in this forum. So in a nutshell I created a method inside the class for the print statements. I'm not sure why IntelliJ seems to not recognize the System.ut package within the class but only in a method. Please comment about that if you have any idea why.
Hello,
At the class body level you can have instance and static member variable declarations, method declarations, nested classes, object initialization blocks, static initialization blocks, and comments. But not method executions.