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 purpose of the System class?
What are the three parts of a lambda expression? What is the type of lambda expression?
What is static block?
describe method overloading
Explain about doubly linked list
Which arithmetic operations can result in the throwing of an arithmeticexception?
When do we use synchronized methods in java?
What is a parameter in matrices?
What do you mean by Function Overloading in java?
Can we create our own daemon thread?
How do you start a thread?
Can an interface be final?
What is thread life cycle in java?
How big is a gigabyte?
Why does java not support operator overloading?