...
Open your IntelliJ IDEA and click on ‘New Project’.
Make sure
Java
is selected on the left hand side andJava 11
asProject SDK
. ClickNext
.You can select the tick-box presented on the next page - the project will be created to accommodate for command line application style code and click
Next
.On the next page, type in the name of your project -
HelloWorld
, you can accept the default location where the project will be created, just make a note of it. And in the last text box type incom.virtual1
. ClickFinish
.Your project will be created and opened in your IntelliJ. You should see a file called
Main.java
. It contains a class definition with amain
method. That's where we will place our code.Type in
System.out.println("Hello world!");
inside the main method.Run your application - right-click into the
Main.java
file and selectRun
.After a short while, you should see a similar output at the bottom part of your IntelliJ window.
Congratulations, you created your first Java application!
Note: Indentation shortcut for IntelliJ Ctrl+Alt+I (letter ‘eye’) or Ctrl+Option+I for Mac.
Note: Quick comment shortcut Ctrl+/ or Command+/.