Why declare Main() method as a static in java ?



Why declare Main() method as a static in java ?..

Answer / Prakhar Narain

In Java, the main() method must be declared as static because it is used to start the execution of the program without creating an object of the class. The JVM invokes the main() method when the program starts.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

what is the difference between cd & dvd ?

30 Answers   Lovely Professional University, Satyam, Sibylsys,


What will be the default values of all the elements of an array defined as an instance variable?

1 Answers  


How does final modifier work?

1 Answers   Tech Mahindra,


What is the meaning of course?

1 Answers  


What are actual parameters?

1 Answers  


Can a class be private or protected in java?

1 Answers  


What is append function?

1 Answers  


Why are inner classes required?

3 Answers   Oracle,


Why we use static and synchronized in method for single thread model example: public static synchronized add(){}

2 Answers  


What are interfaces?

3 Answers  


Explain cookies?

2 Answers   Canon,


java program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.

7 Answers   HCL, Wipro,


Categories