Hello World application
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 Give your project a reasonable name - i.e.
HelloWorld
.You don’t have to change anything else on this page, just note where the project will be saved - in your home folder in
IdeaProjects
.You can click
Finish
.After a short while the project will appear on the left hand side.
Right-click on the src folder and select
New
->Java Class.
Name itMain
.Inside your newly created class, type
psvm
and click enter. It will create amain
method.Inside the main method, type
sout
and Enter. It will generateSystem.out.println("Hello world!");
inside the main method line of code. Within the parenthesis, type"Hello World!"
.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.
...