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 is java thread dump, how can we get java thread dump of a program?
Is alive and join method in java?
Can inner class be public in java?
Differences between C and Java?
Can we declare register variable as global?
How do you input a string in java?
How do you download stubs from Remote place?
Can we extend singleton class?
Is string serializable in java?
Is singleton set an interval?
What is the difference between iterator and enumeration ?
What is field name?
What is increment in java?
What is difference between static class and normal class?
What are the methods used to implement for the key object in the hash map?