Installation 1.IntelliJ-IDEA
http://www.jetbrains.com/idea/download/#section=windows
2.IDEA project structure
Project Project -> Module Module -> Package Package
Item may have a plurality of modules, a module may have a plurality of packets, as shown below:
3. New Project
Double-click to start idea, click on the Create New Project
Click inside the right side of Empty Project on behalf of what are not, then next
Give the project name, do not have Chinese, I called basic-code, click finish to complete the creation.
Then create a module
Jdk here to fill the position, that is your jdk installation path, mine is D: \ Java \ jdk-13.0.1
All the rest are next.
All of our source code is written in the src file:
Create a new package, the package name is usually the domain name over to write.
After all built, you have a path to the corresponding computer files you build. Such as:
4. Write the first Java code
Right-create a new Java class, the class name is called HelloWorld:
Here are some shortcuts, after the master to write very fast, such as:
psvm then enter, the system automatically creates the main function
sout then return is System.out.println ();
Then right-click on the run, or shortcut key ctrl + shift + F10 to run the function.
package cn.day1.demo01; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } }
5.idea commonly used shortcut keys
hot key | Features |
alt + enter | Introducing package, automatic correction codes |
ctrl+Y | Delete cursor line |
ctrl+D | 复制光标所在行的内容,插入光标位置下面 |
ctrl+alt+L | 格式化代码 |
ctrl+/ | 单行注释,再按取消注释 |
ctrl+shift+/ | 选中代码注释,多行注释,再按取消注释 |
alt+Ins | 自动生成代码,toString,get,set等方法 |
alt+shift+上下箭头 | 移动当前代码行 |
6.修改快捷键
在idea中,我们还可以自己修改快捷键
File->Settings->keymap->Main menu->code。