In Java why we write public static void main(String args[])
why not main()?
Answer Posted / deependra prarap singh
in the java when we creat any of the class then the "java's compiler after entering in the class ,
fistly search for the static because the java's compiler know every thing about the static
and then java's compiler search for the main method,
as we know that the main is a method then there should be some return type so we use void because it has no return type
after declaring the void now we use the public because we are to access the main method from any where or outside
"
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
How transient variable is different from volatile variable?
How do constructors use this() and super()?
What is meant by 'Class access modifiers'?
Do you know how to reverse string in java?
Do you know why doesn't the java library use a randomized version of quicksort?
What is an infinite loop? How infinite loop is declared?
Can we have multiple catch block for a try block?
What is a vararg?
What are the string methods in java?
What does provide mean construction?
How does varargs work in java?
How to reverse string in java?
What are the three types of design patterns?
When a lot of changes are required in data, which one should be a preference to be used? String or stringbuffer?
Which is better stringbuffer or stringbuilder?