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 the synonym of procedure?
What is difference between static class and normal class?
What is private public protected in java?
Is string a wrapper class?
What is java thread dump, how can we get java thread dump of a program?
Why string is not a wrapper class?
What is a boolean output?
What is command line used for?
What is a variable declaration?
What are the limitations of procedural programming approach?
How is a variable stored in memory?
What is an interoperable application in java ?
Is a method a function?
What is import java util arraylist?
What does %d do in java?