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 predicate in lambda expression?
Why do we need framework in java?
Are there tuples in java?
What is difference between loosely coupled and tightly coupled in java?
What is @resource annotation in java?
What is the meaning of loosely coupled in java?
What is jpa entitymanager?
What is a stream in java?
How common are security breaches? : java security
Can optional be null?
What is difference between map and flatmap in java 8?
What is java bean class?
What is tight coupling in java?
What are the Advantages of java se 8 new features?
What is a pojo class in java?