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
Where is java installed?
If you’re overriding the method equals() of an object, which other method you might also consider?
Do I really have to type in the programs in the book to try them out?
What is java ioc?
What do you mean by exception handling?
What is difference between loosely coupled and tightly coupled in java?
Spring framework ---Can somebody explain me in easily understandable format about AOP, IOC and DI, so that i can explain in interview rather than just telling what is available in net. I am not able to understand that also. I am new to Spring
What is stateful in java?
What is an api in java?
What is @resource annotation in java?
What is meant by pass by reference and pass by value in java?
How do I run a project in eclipse?
Is openjdk the same as jdk?
What's the difference between local, global and universal groups? : java security
Why java is better than node.js?