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 are constants?
What is close method? How it's different from Finalize & Dispose?
What is bean? Where it can be used?
Can we have any code between try and finally blocks?
How much ram can a 64 bit processor theoretically?
Is java hashset ordered?
How many ways can we create singleton class?
What is difference between word and integer?
What is ascii code?
What do you mean by data type?
What is compareto?
Can inner class be public in java?
What is the difference between array list and vector in java?
How do you trim a space in java?
How can we use primitive data types as objects?