What Is The Meaning Of Public Static Void Main() In Java?


4 Answers

Anonymous Profile
Anonymous answered
Public is the access specifier which means that program can be accessed from anywhere and has no restrictions
Static dictates the compiler that main should be run before anything else in the program
Void indicates that main() will not return any value
Brady Profile
Brady answered
Public means it can be accessed from anywhere.
Static means it does NOT reset variable values each run through(not automatically anyways)
Void means (as far as I know, but I could be wrong), it has no specific type(such as integer, string, double etc)

Main is just the event so the computer knows where the actual code it should run through is. It'll go to that and only do what that event tells you to.
Public- the method can be accessed anywhere within the class or outside the class or even outside the package as well.
Static- the method is shared by all the objects and it does not need any instantiation to be called.
Void- this particular main() cannot return any value so here we have to use void; it's the syntax you can say.
Main()- this is the entry point of the code or the class you can say in java.
String[]args- this is written for run-time commands lines whether you pass them or not you have to write them as stated by James Gosling.

I hope this helped you.
Anonymous Profile
Anonymous answered
Public means it is known to everybody
static means it will have value otherwise the value will be assigned automatically
void means a function
main means it is not a return type

Answer Question