Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Hello World application

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

  2. Make sure Java is selected on the left hand side and Java 11 as Project SDK. Click Next.

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

    Image Removed
  4. 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 in com.virtual1. Click Finish.

  5. Your project will be created and opened in your IntelliJ. You should see a file called Main.java. It contains a class definition with a main method. That's where we will place our code.

    Image Removed
  6. Type in Give your project a reasonable name - i.e. HelloWorld.

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

  8. You can click Finish.

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

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

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

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

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

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

    Image RemovedImage Added

  15. Congratulations, you created your first Java application!

Note: Indentation shortcut for IntelliJ Ctrl+Alt+I (letter ‘eye’) or Ctrl+Option+I for Mac.

...