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 constructors in java?
Why is java called the platform independent programming language?
'A class is a template for an object' explain this statement.
Is stringwriter thread safe?
Why chararray() is preferred over string to store the password?
What is a loop java?
What is the largest data type in java?
Given a singly linked list, find the middle of the list in a single traversal without using temporary variable.
What is difference between array and arraylist in java?
Is array a class in java?
Is node a data type in java?
Explain about fail safe iterators in java?
enlist some features of jdk.
What is percentage in java?
What is meant by flickering?