Why is the main method static in Java?
Answer / nashiinformaticssolutions
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.
| Is This Answer Correct ? | 0 Yes | 0 No |
How does varargs work in java?
What does exp mean in math?
Why wait(),notify(),notifyAll() methods defined in Object class althought we are using in only threads.
How can you traverse a linked list in java?
What are advantages and disadvantages of OOPs?
What are structs in java?
What are desktop procedures?
Can we sort hashset in java?
What is the importance of hashcode() and equals() methods?
How many digits is int32?
When finalize method is called?
Can a main method be overloaded?