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

How do I run a java project in netbeans?

673


What is stateless in java?

731


When is static variable loaded? Is it at compile time or runtime? When exactly a static block is loaded in java?

689


What is flatmap in java8?

713


What happens when you omit a brace or misspell one of the words, like public or

662


Explain the reason for each keyword of public static void main(string args[])?

704


What is singleton pattern in java?

645


What is meant by java se?

698


Which type of stream is in java?

669


Who is at risk in java? : java security

713


How do you run an executable jar file?

676


What is ui framework in java?

653


ioc vs dependency injection?

2088


Which version of my browser should I use? : java security

701


What are jdk tools?

666