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 does enum work in java?
Implementations of set interface?
What is the console in java?
What is the difference between heap and stack memory?
What is a variable declaration?
Can inner class final?
What is a byte string?
Can a class be defined inside an interface?
What type of language is java?
What is nextint java?
How do you start a new line in java?
What is the base class in java from which all classes are derived?
How is a variable stored in memory?
In java how do we copy objects?
What are adapter classes?