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 is skeleton and stub?
Why do we create threads in java?
What is primitive data type in java?
Explain about class in java?
Which number is denoted by leading 0x or 0x in java?
What is method overriding in java ?
What is null data type?
What flag up means?
Can we increase array size dynamically in java?
What is a priority queue java?
Why are the objects immutable in java?
we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.
What is a static method in java?
Is logger a singleton?
Is string is a keyword in java?