In Java why we write public static void main(String args[])
why not main()?

Answer Posted / sudheer nath

public means the main functiio can be accessible outside the class the jvm remain outside the class so we add the public visiblity mode.
static means the compiler automatically called the main ()functio without creating its instance or object.
void is the return type of the main function means main() does not return any kind of values to its caller means jvm.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where is jre installed?

591


Why string is immutable or final in java

616


How can we create a synchronized collection from given collection?

589


What is string array?

582


What is a type parameter in java?

532






Is string passed by reference in java?

548


What is command line argument in java?

608


How many ways can we create singleton class?

506


What is constructor chaining and how is it achieved in java?

573


Can bool be null?

526


What is the difference between normal report & matrix report?

573


how to prepare for IT Officers Interview in Banks

1505


What is the difference between stored procedure & function?

550


How can you add and remove nodes in jtree?

614


What is the final class?

550