Java “Hello World” with Eclipse

  1. Open Eclipse

    • Launch Eclipse IDE.
  2. Create a New Java Project

    • Go to File > New > Java Project.
    • Enter a project name (e.g., HelloWorld) and click Finish.
  3. Create a Java Class

    • Right-click on the src folder inside your project.
    • Select New > Class.
    • Enter HelloWorld as the name of the class.
    • Check the box for public static void main(String[] args) to create a main method.
    • Click Finish.
  4. Write the “Hello World” Code

    • Inside the HelloWorld class, replace the default code with:
        public class HelloWorld {
          public static void main(String[] args) {
              System.out.println("Hello, World!");
          }
      }
      
  5. Save the File

    • Press Ctrl + S (Cmd + S on macOS) to save the file.
  6. Run the Java Program

    • Right-click anywhere inside the main method.
    • Select Run As > Java Application.
  7. View Output

    • You should see Hello, World! printed in the Console tab at the bottom of Eclipse.

Java “Hello World” with IntelliJ IDEA

  1. Open IntelliJ IDEA

    • Launch IntelliJ IDEA IDE.
  2. Create a New Project

    • Click on Create New Project or File > New > Project.
    • Select Java on the left pane and click Next.
    • Enter a project name (e.g., HelloWorld) and click Finish.
  3. Create a New Java Class

    • Right-click on the src folder inside your project.
    • Select New > Java Class.
    • Enter HelloWorld as the name of the class and click OK.
  4. Write the “Hello World” Code

    • Inside the HelloWorld class, replace the default code with:
      public class HelloWorld {
        public static void     s main(String[] args) {
            System.out.println("Hello, World!");
        }
    }
      
  5. Save the File

    • Press Ctrl + S (Cmd + S on macOS) to save the file.
  6. Run the Java Program

    • Right-click anywhere inside the main method.
    • Select Run 'HelloWorld.main()'.
  7. View Output

    • You should see Hello, World! printed in the Run tab at the bottom of IntelliJ IDEA.