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 are the different ways to handle exceptions?
What does @override mean?
Is stringwriter thread safe?
What are Normalization Rules? Define Normalization?
What is use of super keyword in java?
What do you mean by inner class in java? Explain
What kind of variables can a class consist?
Difference between concurrent hashmap and hashtable and collections
What happens if we don’t override run method ?
How do you compare objects in java?
What is module in oop?
What does arrays sort do in java?
What is thread life cycle in java?
Is java a utf 8 string?
What is meant by attribute?