01 - Introduction to Java - Exercise 1
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
.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("");
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.
Note: Quick comment shortcut Ctrl+/ or Command+/.