I know why the main method is static. If this is static, there is no need to instantiate this class using the JVM. Without an object, we can call it. But why is the object not needed to call the static method?
Can someone please explain?
The static method is associated with the class, and not with any instance of the class.
See http://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html
: , . , PSP . PSP, .
- (/), PSP - , - , - .
. Static , . .
- , static - , , .
JVM ( ). , ? , , interface, main. :
interface
main
interface ApplicationStarter { void start(String []args); }
. , , SPI, (no-arg). , (, no-arg , , Serializeable ), . "" - .
Serializeable
/ (main), : , .
main() , .
main()
Static, ,
Static
, , - , , . , , .
java java .
I am new to java, so please forgive me if my answer is wrong.