Why do we use public static with the main function in Java?
Answer Posted / rana
As we know public means we can access the method from
anywhere.Coming to static:- main() is a static method
therefore it implies that there is no need of creating
Object for that particular class to call this method.So
that when ever u run the program the Jvm will search for
main() in the class even there r no class objects created
for this class.
| Is This Answer Correct ? | 20 Yes | 7 No |
Post New Answer View All Answers
What do you mean by aggregation?
What is the purpose of default constructor?
Is main is a keyword?
How does varargs work in java?
What are the different approaches to implement a function to generate a random number?
What are namespaces in java?
Can you achieve runtime polymorphism by data members?
what is the difference between Object Based Language and Object Oriented Language?
Why does java does not support multiple inheritance? Explain
What is polymorphism java example?
what r advatages of websphere? & how to deploy?
Which java version is latest?
What do you understand by an io stream?
What is the purpose class.forname method?
How to perform linear search in java?