001_intellij idea优化_生成main方法_自动补全代码_live template

用惯myeclipse,输入main可自动生成main方法,输入syso可自动生成打印语句,但是到idea发现就不行了。

idea的代码补全分两类:1是单词补全,2是模板替换

其中模板替换可自定义:setting中的live template中

1、新增文件夹(template group):如:java

2、新增模板(live template):如:main

3、填写模板内容

public static void main(String[] args){
    
}

4、增加变量:光标会定位到变量方便修改,也可为空,仅定位光标,可以给变量设置默认值

public static void main(String[] args){
    $start$
}

5、定义作用域:如整个java作用域

6、定义触发快捷键:如enter

确定后,回到java类中测试,输入main,按tab键,main方法就生成了,且光标定位在start变量处

posted @   arun_python  阅读(309)  评论(2编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示