why java main method is given as static method?

Answer Posted / saravanan.v

Java is a object oriented language.So even main method also should be written inside a class name main class.So main method should be called WITHOUT CREATING OBJECT for main class.For this purpose, it is declared as static.

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

why are wait(), notify() and notifyall() methods defined in the object class? : Java thread

766


State one difference between a template class and class template.

858


What is mysql driver class name?

832


How many types of exception can occur in a java program?

728


When is the finalize() called? What is the purpose of finalization?

844


What is the benefit of inner / nested classes ?

742


Given a singly linked list, how will you print out its contents in the reverse order? Can you do it with consuming any extra space?

814


What is a pointer and does java support pointers?

794


Write a program to print fibonacci series

818


What is are packages?

795


Why do we create public static method in java?

822


What is a war file?

770


What is Major and importance difference between for and foreach loop ?

842


What is procedure overloading?

2041


what are the disadvantages of indexes in oracle?

2093