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

Answer Posted / dadhich

main method is declared as static because we cannot call the method without creating the object of the class.When we declare class and in which if we define main method then it is must to use the static keyword.static keyword helps to execute the main method without instantiating the class.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is microservices java?

534


What is the point of lambda expressions?

559


Who created eclipse?

569


What is a driver in java?

601


How do I enable java in google chrome?

521






What is the locale class?

617


How do I install java on windows?

540


How can you work with permissions from your .net application? : java security

575


what is reflection api? How are they implemented?

598


What is a static method?

593


What is transaction management in java?

576


How does jpa repository work?

596


What is ehcache in java?

581


What is meant by framework in java?

584


Why do we need framework in java?

524