/
01 - Introduction to Java - Exercise 1

01 - Introduction to Java - Exercise 1

Hello World application

  1. Open your IntelliJ IDEA and click on ‘New Project’.

  2. Give your project a reasonable name - i.e. HelloWorld.

  3. 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.

  4. You can click Finish.

  5. After a short while the project will appear on the left hand side.

  6. Right-click on the src folder and select New->Java Class. Name it Main .

  7. Inside your newly created class, type psvm and click enter. It will create a main method.

  8. Inside the main method, type sout and Enter. It will generate System.out.println(""); line of code. Within the parenthesis, type "Hello World!".

     

  9. Run your application - right-click into the Main.java file and select Run.

     

  10. After a short while, you should see a similar output at the bottom part of your IntelliJ window.

     

  11. 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+/.