What is 'Public Static Void Main' in Java?

An error occurred trying to load this video.

Try refreshing the page, or contact customer support.

Coming up next: Java Naming Conventions: Classes & Methods

You're on a roll. Keep up the good work!

Take Quiz Watch Next Lesson
Your next lesson will play in 10 seconds
  • 0:04 Public Static Void Main
  • 0:57 Public and Static Methods
  • 1:54 Void
  • 2:11 Main
  • 2:26 String Args
  • 3:27 Lesson Summary
Save Save Save

Want to watch this again later?

Log in or sign up to add this lesson to a Custom Course.

Log in or Sign up

Speed Speed

Recommended Lessons and Courses for You

Lesson Transcript
Instructor: Martin Gibbs

Martin has 16 years experience in Human Resources Information Systems and has a PhD in Information Technology Management. He is an adjunct professor of computer science and computer programming.

You'll see it often in Java programs, but what does 'public static void main' really mean? This lesson will cover this core component, a requirement of any Java program.

Public Static Void Main

You see it in almost every Java program. You know, the declaration public static void main. It is the means by which you create a main method within the Java application. It's so common that developer tools often include these key words in their templates.

But what do they mean? Let's walk through a variation of the cliched Hello World application, and instead create an application that displays On the Bounding Main.

First things first: the main part of the statement is the method. That is, it is the block of code that is actually going to display our output. Therefore, it needs to be included within a class.

In this case, the class will be called BoundingMain.

Here is the code:

Java Void Main

Even though this is the main method, it may be hard to notice since the keyword is buried in the other keywords. Let's break those down so that this common statement is better understood.

Public and Static Methods

The first word in the statement, public, means that any object can use the main method. The first word could also be static, but public static is the standard way. Still, public means that it is truly the main method of the program and the means by which all other code will be used in the program.

Even though you could write static public or public static, the program will work just fine. Still, it's more common to use public static. In the context of Java, the static keyword means that the main method is a class method. What this also means is that you can access this method without having an instance of the class. Remember that the public keyword makes the method accessible by all classes, so this makes it possible.

Remember when we started at the beginning by calling this class the BoundingMain? In order to get the main method to work within our BoundingMain class, we need the static keyword. The main method can only be entered within an overarching class.


The keyword void tells Java that the main method won't return a value. Other methods in other classes can receive and return values/variables, but main can't return anything. It's the main event and the star of the show. To this end, void is not a negative.

To unlock this lesson you must be a Study.com Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use Study.com

Become a Study.com member and start learning now.
Become a Member  Back
What teachers are saying about Study.com
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? Study.com has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account