In Java why we write public static void main(String args[])
why not main()?
Answer Posted / marrapu venkatesh.
Public: the reason for using public is to be accessed by the jvm. if u write private it should not be recognized by the jvm to execute. public methods accessed out of the class that's why we write public.
Static: the reason for static is when the program execution start main method should be invoked first. static method is called first. because we cant create object to main class to call methods. that's why we write static.
Void: In java main function does not return any value.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the basic concepts of OOPS in java?
Explain the difference between jdk, jre, and jvm?
What is purpose of find feature?
What is the difference between C++ and Java and your preferences?
What is the class in java?
How do you print array in java?
What are the restrictions imposed by a Security Manager on Applets?.
How does enum work in java?
What are the Class Libraries ?
What is a null check?
What is the static variable?
How will you get the platform dependent values like line separator, path separator, etc., ?
What is the intersection and union methods?
Why we go for collections in java?
What are the Static and Dynamic Variables? Differentiate them.