In Java why we write public static void main(String args[])
why not main()?
Answer Posted / manikandan
in java , the entry point for execution is Main(),
it is tha first method to be invoked .
so PUBLIC is declared for no duplicates should occur and for
global declaration .
VOID , the main method will not return any value . So void
is declared .
Finally STATIC , in java everything is accssed through
objects . But here main() is the first method to be invoked
. STATIC is defined for this purpose , If a method is
declared as STATIC it can called without any objects
reference .
So the Main() in java is defined as
public static void main(String args[])
| Is This Answer Correct ? | 50 Yes | 15 No |
Post New Answer View All Answers
What is integers and example?
Where are the local variables stored?
If system.exit (0); is written at the end of the try block, will the finally block still execute?
What are the two ways of implementing multi-threading in java?
How do you generate random numbers in java?
What’s meant by anonymous class?
What is arrays sort in java?
How do you declare a destructor in java?
What are the parts of methodology?
Which methods cannot be overridden in java?
How do you add an element to a set in java?
Why char array is favored over string for the storage of passwords?
What is flush buffer?
Is 64bit faster than 32 bit?
Explain about core java?