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
What is optional in java 8? What is the use of optional?advantages of java 8 optional?
What is the difference between ec2 and lambda?
Explain main thread under thread class execution?
Which type of stream is in java?
What is resultsetmetadata in java?
What is orm in java?
When do we go for java 8 stream api? Why do we need to use java 8 stream api in our projects?
What is the first argument of the string array in main method?
How to reverse the singly linked list(In Node data members are(int data,int pointerTONext))
Can a dead thread be started again?
What is meant by framework in java?
What is the purpose of jdk?
Why dependency injection is used in java?
What is java api?
What happens when the parent process of a child process exits before the child ?