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
In a container there are 5 components. I want to display all the component names, how will you do that?
Why there is no call by reference in java?
Which command from the jdk compiles a java program?
What is a void method?
What are the different types of sorting in java?
How many types of design patterns are there?
What are java methods?
Implement two stacks using a single array.
What are the basics of core java?
What is arguments in java?
How do you add an element to a hashset in java?
What is mnemonic in assembly language?
What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?
How many types of exception can occur in a java program?
What is the use of singleton?