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
How we can make copy of a java object?
What are the types of casting?
When should a function throw an exception?
What are invisible components?.
Can we serialize static variables in java?
Distinguish between a predicate and a function?
what are Hostile Applets?
What is the latest java version?
What is a local class in java?
Explain the difference between extends thread vs implements runnable in java?
Give few difference between constructor and method?
What is a numeric string?
Is linkedlist thread safe in java?
How to make a write-only class in java?
What is set in java?