Explain Public static void main?

Answer Posted / ranganathkini

public static void main( String[] args )

1. public - declares that the main method is publicly
accessible to other classes

2. static - declares that the main method can be invoked
without creating an instance of the class

3. void - declares that the main method does not return any
value.

4. main - defines the name of the method

5. String[] args - defines a parameter to the main method
which will contain any command line options passed by the
user when invoking the progam.

These command line options will be passed to the program as
an array of string objects.

Is This Answer Correct ?    182 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is mnemonic code?

543


What is an interface in java?

563


What is a private class in java?

512


What happens to the Exception object after handling an exception?

1818


Similarity and difference between static block and static method ?

539






What is a flag variable?

561


What is complexity and its types?

528


Explain java coding standards for interfaces?

635


Why are functions called methods in java?

535


what is encapsulation in java? Explain

666


how to one war file class to another war file class?

1554


Why java is said to be pass-by-value ?

552


What is the purpose of the return statement?

520


Is string passed by reference in java?

549


What are the different types of inner classes?

536