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
Mention a package that is used for linked list class in java.
what is the difference between the methods sleep() and wait()? : Java thread
How are this() and super() used with constructors in java programming?
Can we change the value of static variable?
Does java support multiple inheritances?
What is a qualifier in a sentence?
Can we inherit a class with private constructor?
What is included in core java?
What sorting algorithm does javascript use?
What is floor in java?
Why java uses the concept of the string literal?
What is an example of declaration?
What is numeric function?
How do I enable java in safari?
What is the difference between normal report & matrix report?