What is the need to declare main() method as static in Java?

Answer Posted / monalisa

public static void main(String[] args) means
public - is the access modifier .if we declare a method as
public means we can access the method out side of the class.
static - It is a key word.If we declare a method as static
then we can call this method with out creating any instance
of that class.Directly we can call it by "CLASSNAME.STATIC
METHOD NAME"
void - It is the return type of the method
main - It is the Method name

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Are there tuples in java?

591


What is connection pooling in java?

618


Can I have multiple main methods in the same class?

548


What are the rules regarding quotation marks?

533


What is the use of flatmap in java 8?

540






Do I need to install jre if I have jdk?

547


What services can invoke lambda?

548


Who created eclipse?

568


What is jpa used for?

580


What is meant by rest api in java?

552


What is a yaml file in java?

569


What is meant by annotations in java?

560


Describe the principles of oops.

567


Define network programming?

606


Which instutute is offering course for rhino jain slee

1930