Your First Java Program

Let's create a simple "Hello, Java!" program:

  1. Create a Java Project: Click on "File" > "New" > "Java Project." Give your project a name, like "HelloJava," and click "Finish."

  1. Create a Package: Right-click on your newly created project, select "New" > "Package." Enter a package name, like "com.example.hello," and click "Finish."


  2. Create a Java Class: Right-click on your newly created project, select "New" > "Class." Enter "HelloWorld" as the name and check the box for "public static void main(String[] args)." Click "Finish."

  1. Write Code: In the code editor, you'll see the main method. Write the following code inside it:
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, Java!");
    }
}
Run the Program: Right-click on the code editor and select "Run As" > "Java Application." You should see "Hello, Java!" printed in the Console view at the bottom.