Simple Hello World program using IntelliJ IDE

In this article, we would go through the basics of working with IntelliJ IDEA IDE. At the end of this post, you should be able to run a simple java program using the IDE. We assume that Java and IntelliJ installed on the machine. Let’s get started!

Install IntelliJ Steps:



Java Hello World

Create a New Project

To create a project in IntelliJ, follow the steps at:

New Java class

The next step is to create a New class. In the project side window, right-click on the src folder and choose

Right-click >> New >> Java class

Type the class name, for example, HelloWorld.


It’s encouraged to specify the package for your class. We have specified “com.testingdocs.demo”. Java packages are like directories or folders that hold java classes to avoid name conflicts. We cannot have a “HelloWorld” class twice in the same package  “com.sample.demo”. However, we can have a”HelloWorld” class in a different package let say “com.testingdocs.sampledemo”.


Create Hello World Application

package com.testingdocs.demo;
public class HelloWorld { public static void main(String[] args) { // write your code here System.out.println("Hello world!"); }


Now that you have your class, in the main() method, add the following statement to print “Hello World!” on the console. Then save your changes

Run the java application

To run your application, right-click on your class and select Run main. The Console view should appear at the bottom and display the “Hello, world!” output.



Console output.

After the java application run, you would see the console output that displays “Hello World!”. 

Hooray! You have successfully created a Hello World Java application using IntelliJ IDEA.