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

Why string is immutable with example?

526


Can we have this () and super () together?

607


How do you use parseint in java?

511


What is module in oop?

569


Why java doesn’t support multiple inheritances?

584






How many ways can we create the string object?

532


List some important characteristics on jre

594


Why is sizeof not a function?

547


How do you decide when to use arraylist and linkedlist?

532


How do you sort data in java?

525


How objects of a class are created if no constructor is defined in the class?

578


What is passing by reference in java?

537


What is sortedmap in java?

549


Difference between arraylist and vector.

590


How many tetrahedral voids are there in bcc?

544