In Java why we write public static void main(String args[])
why not main()?
Answer Posted / prabhakant prabhakar rasal
We write public because to access main() method outside the
class.
Why static because to invoke main() method before creating
any object, so it simple to compiler that to identify the
main() method.
void, it represents that it does not returns any value.
string args[]
There are two main reasons to write string args[]
1. TO identify the program
2. To get command_line arguments
| Is This Answer Correct ? | 27 Yes | 13 No |
Post New Answer View All Answers
What are the methods available in a class?
What is scope & storage allocation of static, local and register variables? Explain with an example.
What is the difference between an inner class and a sub-class?
What is the difference between conversation & casting?
Can list be null in java?
How many types of equations are there?
List some java keywords sun like c, c + + keywords?
Which is easier netbeans or eclipse?
What is stack explain?
What is navigable map in java?
Tell me about your ability to work under pressure
What is arraylist e?
What is a dynamic array java?
What is a local, member and a class variable?
Why java applets are more useful for intranets as compared to internet?