why we write public static void main (String args[])
in core java plz explain briefly??????????????????
Answer Posted / nilay
because in JAVA everything is within class and should be
called with classname(static methods) or with instance of
that class. but main is the first method to be called when
no instances are in memory so that is why it is static and
is called like <classname>.main() by System class. and it
must be public because it is called from outside enviornent
of current class file. String[] is for the command line
arguments that you pass when you run your java program
by "java .classfile arg1 arg2" so all arguments are
received here and for multiple arguments it is an array of
strings. it does not return anything so it's return type is
void.
| Is This Answer Correct ? | 17 Yes | 0 No |
Post New Answer View All Answers
What is the numeric promotion?
Why java is secure? Explain.
Explain reverse a linked list recursive java solution?
Explain notify() method of object class ?
How would overload a function based on return type?
How many bytes is a string?
What is use of super keyword?
What is meant by class and object in java?
Can a hashset contain duplicates java?
What is meant by design patterns?
What is the difference between size and length in java?
Tell us something about set interface.
Why vector class is used?
is it possible to instantiate the math class?
What is compareto?