Learn to Code: Your First Java Program

January 3, 2019

Often, a program called Hello World is used to introduce a new programming language to beginners.

It is a simple program that outputs Hello, World!. In this section, you will learn to write the same program in Java using Eclipse.

  1. Open IntelliJ IDEA.
  2. Go to File > New > Project… Java (on the left navigation)
  3. Give the Project Name. We will call it Hello World for now and click Finish
  4. Now, you need to create a new Java class.
  5. Select HelloWorld’s src folder in the left sidebar. When it is selected, go to File > NewJava Class and give Name to the class and click Ok. We will call it HelloWorld.
  6. Copy the following code in file and save it. (Shortcut: Ctrl +S, or Cmd +S for Mac)
    public class HelloWorld {
        public static void main(String[] args) {
            // prints "Hello, World!"
            System.out.println("Hello, World!");
  7. Finally, hit run button. If everything goes right, you will see Hello, World! output on the screen.