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

Answer Posted / paletipatisrinu

public static void main(String k[]) here

public:The main method will be called by jvm.so jvm is
located some other place so invoke our main() should be public

static:before object is creation calling main() method so
the main() method will be called by using static

void:so jvm does not expected any return value
main():its method name
String[]:argument type is String

Is This Answer Correct ?    17 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the meaning of loosely coupled in java?

534


Is it correct to say that using parentheses can only change?

560


What is optional in java 8? What is the use of optional?advantages of java 8 optional?

570


What is ehcache in java?

581


Why is class forname used in java?

585






What is an api in java?

577


Is jar an executable?

533


How to reverse the singly linked list(In Node data members are(int data,int pointerTONext))

1413


What is map and flatmap?

690


What is a service layer in java?

490


I want to control database connections in my program and want that only one thread should be able to make database connection at a time. Define how can I implement this logic?

660


What is war file in java?

641


Do I need both jdk and jre?

560


What type of parameter passing does java support?

537


What is explicit casting?

622