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


Please Help Members By Posting Answers For Below Questions

Name component subclasses that support painting in java programming?

624


What are the differences between Java 1.0 and Java 2.0?

1662


What are the two types of java?

509


What is arrays aslist in java?

505


In case of inheritance what is the execution order of constructor and destructor?

631






How java enabled high performance?

576


Is hashset sorted in java?

656


Difference between object instantiation and construction ?

572


Why do we use predicate in java?

547


How do you sort a list in java?

566


Can you start a thread twice in Java?

621


What are measurable parameters?

559


You're given a Boolean 2D matrix, can you find the number of islands?

587


What does ide stand for?

509


What is the difference between jdk and jre?

598