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 container in java?
How do I open the java control panel?
What is a java executable jar file?
What is scrollable resultset in java?
What is the difference between Logical Parallelism and Physical Parallelism?
What is a stream in programming?
Why do we only use the main method to start a program?
Can an application have multiple classes having main method?
What is an action class in java?
What is cmp in java?
What are the benefits of a jar file?
What is contextpath in java?
there are 67 seats in train . there are only 5 seats in a row and in last row there are only 2 seats. One person can reseve only 5 seat at a time. If person reserving seat , the care is atken that he may get all in row. if seats are not available in row then the arrangement is so that person group get nearby seats. the following class is given public class seat { char name; int seat; boolean isSeatempty } 1.Draw require class digram and object diagram. 2.Write function seatallot(int noofperson) to allocate seat with seat nuber printed for the each name.
What is the purpose of jdk?
Is php faster than java?