Hello World application
Open your IntelliJ IDEA and click on ‘New Project’.
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
.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+/.