What is the need to declare main() method as static in Java?
Answer Posted / dadhich
main method is declared as static because we cannot call the method without creating the object of the class.When we declare class and in which if we define main method then it is must to use the static keyword.static keyword helps to execute the main method without instantiating the class.
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is a delimiter in java?
Why do we only use the main method to start a program?
How can the static main method use instance variables?
Do I really have to type in the programs in the book to try them out?
If you’re overriding the method equals() of an object, which other method you might also consider?
What is use of jpa?
Write a program using call by refernce for two different classes to explain to print whether a given number is automorphic or not.
Is java singleton thread safe?
Name primitive java types.
What is dto layer in java?
What is the difference between a jvm and a jdk?
Why doesn’t the main method throw an error with no arguments?
What is ui framework in java?
Which framework is best for rest api java?
What are struts java?