Java Data Types and Variables Setup

Setup

Launch the IntelliJ IDEA application.

Select the New Project option.

Name the project java-control-flow.

Create the project in the ~/code/ga/lectures directory.

⚠️ Windows users, the lectures directory is likely at this location on your device: C:\Users\username\code\ga\lectures (replacing username with your username). Create the project in that directory instead.

Choose the Maven build system option.

Ensure the JDK used is temurin-17. This should be the default setting when starting a new project. If it’s not, alert your instructor.

Ensure that the Add sample code option is not checked.

After confirming that the New project window looks similar to the screenshot below, select the Create button.

A new project being created with the appropriate values - java-data-types-and-variables is the project name, it's located in the ~/code/ga/lectures directory, the JDK is temurin-17, and the add sample code option is has been unchecked.

Right-click on the src/main/java directory and select New > Java Class, as shown in the screenshot below:

The beginnings of a new Java class in the src/main/java directory

Name your new class org.example.Main as shown below.

The org.example.Main class getting created

When your New Java Class prompt looks like the above, select the Class option from the list, and you should be taken to the new Main.java file as shown in this screenshot:

Finally, we have a Main class!

Add the required main() method inside of the Main class, including a print statement to confirm our setup worked:

    public static void main(String[] args) {
        System.out.println("This works!");
    }

Run this file now to test that our setup worked. Use the green play button in the top bar shown in the screenshot below, or use Ctrl + R.

Run the Main.java file

A Run panel will appear at the bottom of the window, and you should see a message: This works!

We can get to work now that our project is set up.