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
Why main method is called first in java?
How do you sort a list in java?
Can we sort arraylist in java?
What is the use of arrays tostring () in java?
How many types of methods are there?
Why are data types important?
Why stringbuffer is faster than string?
What happens when you add a double value to a string?
What is a nonetype?
What is the list interface?
What checkbox method allows you to tell if a checkbox is checked?
What is consumer interface?
What are the characteristics of java?
What is map java?
What is the difference between JDK and JVM?