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 interface in java? Explain
What are the special characters?
What is palindrome in java?
What are keywords in java?
What is function declaration?
How many bytes is a string in java?
What is balanced tree in java?
when should you use stringbuilder class in a program?
What is jpa specification?
What is the indent key?
What is contract between hashcode and equal method?
Can we modify the throws clause of the superclass method while overriding it in the subclass?
What variables are stored in stack?
What is multiple inheritance? Is it supported by java?
What are different types of control structures?