In Java why we write public static void main(String args[])
why not main()?
Answer Posted / prasu
public means this method is called from out side of the
class, means we create the object out side of the class that
situation method is available to object.
viod means return type of the method is nothing.the caller
of main() i.e jvm can not recive any thing from called main().
Static means when ever the class is loaded into memory first
static block is executed so,first jvm calls main().
string args[] is an array,it will receive string type of
arguments.
why we write only that type of specification is because jvm
knows only that type of specificatroin.
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What is a module function?
What is a static method in java?
Can a static class have a constructor?
How to connect to a remote database using Applet?
What is the purpose of main function in java?
Explain the difference between jvm and jre?
What is :: operator in java?
Difference difference paint() and paintcomponent()?
A person says that he compiled a java class successfully without even having a main method in it? Is it possible?
What is reverse function?
Can each java object keep track of all the threads that want to exclusively access it?
Can we serialize arraylist in java?
Which eclipse is best for java?
Can you sort a string in java?
What is an class?