Open IntelliJ Idea and select "Create New Project" in the wizard
In the New Project tab, name Project, and this time we'll name the project HelloWorld
Click Next to proceed to the next step, and then click Finish to complete the creation.
In the project manager on the right, expand our "HelloWorld", right-click on "src" and create a new "Java Class" file
The previous step was to create a new ". Java" file. Its rules are the same as normal. java files.
If we write multiple classes in this file, then under SRC, all the classes will be expanded directly. But they are still in a. java file.
That is, the class shown in SRC is based on the. Class.
Then our Java source file name is "Helloworld.java"
Then write the code, in order to facilitate the interpretation of the above mentioned SRC situation, I wrote in the Helloworld.java two classes:
But we're not going to be able to execute this program, and we need to configure a little bit more.
Click "Edit configurations ...", in the open window midpoint "+", add a "application"
The term "Name" can be changed, and after the change, it looks more comfortable, we change it to "HelloWorld"
In the item "main class" to fill in the class name of the class containing the main function, the main function of our program is in class HelloWorld, here we fill in the HelloWorld
Other items do not need to be modified, just click "OK" to complete
And then we'll find that there's a little bit different here, which means starting from the main class HelloWorld.
Click on the green play symbol that represents "execute," and then a Java Project is done.
Git address: https://github.com/wenph/java_day_01am