r/javahelp • u/Miserable_Bar_5800 • Jan 29 '26
What is a public static void?
Why do some not include public in it, like:
static void
why not add public?
what does public even mean?
0
Upvotes
r/javahelp • u/Miserable_Bar_5800 • Jan 29 '26
Why do some not include public in it, like:
static void
why not add public?
what does public even mean?
View all comments
Show parent comment
1
u/vowelqueue Jan 30 '26
Are you talking about the “main” method of your program?
If so, this behavior is something that changed very recently. For nearly 30 years in Java the “main” method of a program needed to be public and static, and accept a String array as a parameter:
In the latest release it’s now more flexible, you can you also write just: