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

What is mime in java?

699


Is java built on c?

700


What is the difference between swing and awt components?

858


What is java flatmap?

662


Why do we need new date and time api in java se 8?

682


What does el mean in java?

821


What is tight coupling in java?

706


ioc vs dependency injection?

2103


What is stateless and stateful in java?

710


Why bean class is used in java?

671


What is web xml java?

686


What is the difference between lambda expression and anonymous methods?

696


How do I enable java in firefox?

767


How do you type the lambda symbol?

699


Define network programming?

732