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

Java.util.regex consists of which classes?

537


What does regex mean?

561


What is extension method in java?

559


In a program, initializing an array of 100 KB is throwing an out of memory exception while there is 100 MB of memory available. Why?

568


What is tree in java?

485






Write a java program to check if a number is prime or not?

532


How to handle a web browser resize operation?

537


What is difference between Heap and Stack Memory?

530


What is the syntax and characteristics of a lambda expression?

550


What is proper subset?

533


What do you understand by soft reference?

582


Does java isempty check for null?

565


Difference between this() and super() ?

569


Why is stringbuffer thread safe?

565


Differentiate between overriding and overloading cases?

590