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 java packages?
Can singleton class be cloned?
Can we assign the reference to this variable?
What does .equals do in java?
Can we override tostring method in java?
What is the reflection?
What is java and why do we need it? Explain
What are the features of junit?
How do you end a program?
What is the difference between static and global variables and also define what are volatile variables?
What is the covariant return type?
Explain the difference between abstraction and encapsulation.
What is a dynamic array in java?
What differences exist between iterator and listiterator?
How to access arraylist elements in java?