Q&A
Ask and answer questions to make information more available to wider audiences.
Eduardo Birch @eduardobirch   30, Jun 2023 12:00 AM
main method
Why is the main method static in Java?
answers 1
 
Answer 1
Noah Antills @noahantills   07, Jul 2023 02:20 PM
Java's main() function is static by default, allowing the compiler to call it either before or after creating a class object. The main () function is where the compiler begins programme execution in every Java programme. Thus, the main () method needs to be called by the compiler. If the main () method is permitted to be non-static, the JVM must instantiate its class when calling the function.