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

Can the main method be overloaded?

566


What is web container in java?

529


Which is best framework in java?

505


Is java singleton thread safe?

492


What is an api in java?

490






Are streams faster than for loops?

506


What is Map,List,hashtable,ArrayList and difference between them??

2280


What is java web application?

475


What is a java proxy?

507


Can the main method be declared final?

535


What is adoptopenjdk?

525


What are the Advantages of java se 8 new features?

546


Define network programming?

535


Why is lambda expression used?

500


What is interceptor in java?

472