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
What is the difference between size and length in java?
Why are parameters used in functions?
Why are the methods of the math class static?
Explain importance of inheritance in java?
What are the three types of design patterns?
What are the types of java languages?
What is final method in java?
is there a separate stack for each thread in java? : Java thread
Explain different ways of creating a thread. Which one would you prefer and why?
What is super in java?
How to compare two strings in java program?
What are the different types of sorting in java?
Which sorting is best in java?
How do you calculate square roots?
What is the unit of plancks constant?