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
Why do we use regex?
What is procedure overloading?
What is a substring of a string?
What are constants?
What do you mean by light weight and heavy weight components?
What is array list in java?
What is the difference between numeric and integer?
What is an immutable object?
How will you calculate the depth of a binary tree if the tree contains 15 nodes?
How many static init can you have?
What is composition in java?
What is parsing a sentence?
How does arraylist size increase in java?
What is java virtual machine? Explain
How to pass arraylist to stored procedure in java?