Object-Oriented Java

The main Method

We're almost ready to use our custom Dog class! But first, we need to understand how to structure and run our Java program.

You may have noticed a mysterious looking line of code in previous lessons that looks like this:

public static void main(String[] args) { }

This is Java's built-in main method. We will learn more about methods and keywords around the main method later on, but first let's understand what the purpose of main is.

  1. When Java runs your program, the code inside of the main method is executed.

For now, you can ignore the keywords in the main method that we have not yet covered. You will learn about them later in the course.

Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.