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 tree node in java?
What is the use of toarray () in java?
What is integer size in java?
Do you need to import math in java?
What are inner classes or non static nested classes in java?
What is the use of System class?
Can we define package statement after import statement in java?
Explain what are final variable in java?
What do you mean by compiler?
What are the advantages and disadvantages of reference counting in garbage collection?
What is the difference between yielding and sleeping in java programming?
What is the use of a conditional inclusion statement in Java ?
Which number is denoted by leading 0x or 0x in java?
What are the two environment variables that must be set in order to run any java programs?
What is file in java?