Why is the main method static in Java?



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

Post New Answer

More Core Java Interview Questions

Write a program to find maximum and minimum number in array?

0 Answers  


what release of java technology are currently available what do they contain?

1 Answers  


Can you override a final method?

0 Answers  


How many bits is a 64 bit byte?

0 Answers  


What is the default size of set in java?

0 Answers  


what is the use of reference variable

6 Answers  


How do you make a thread in java?

0 Answers  


Can an integer be null java?

0 Answers  


Why scanner is used in java?

0 Answers  


What are non-access modifiers?

2 Answers   Cognizant,


How do you clear a method in java?

0 Answers  


explain about method overloading and method overriding with difficult examples

4 Answers  


Categories