The main method should be static for the reason
A. It can be accessed easily by the class loader.
B. It can be accessed by every method or variable without any hindrance.
C. It can be executed without creating any instance of the class.
D. None of the above
Answer: Option C
Join The Discussion
Comments ( 2 )
What is a constructor in Java?
A. A special method to create instances of classes
B. A method used for mathematical calculations
C. A method to perform string manipulations
D. An exception handling mechanism
In Java, which method is automatically called when an object is created?
A. start()
B. main()
C. init()
D. constructor()
What is method overloading in Java?
A. Defining multiple methods with the same name in the same class
B. Calling methods from another class
C. Using methods to load data from a file
D. Running methods in parallel threads
In the case of the main method, it is invoked by the JVM directly, so it is not possible to call it by instantiating its class. And, it should be loaded into the memory along with the class and be available for execution. Therefore, the main method should be static.
Ooo thank u so much veere....nheeriyan dhaa tiyan veere....aggarwaal da phoosa paad ta veere