Why don't we need to create an object for a static method?

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?

+5
source share
7 answers

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

+6
source

: , . , PSP . PSP, .

- (/), PSP - , - , - .

. Static , . .

+4

- , static - , , .

0

JVM ( ). , ? , , interface, main. :

interface ApplicationStarter
{
    void start(String []args);
}

. , , SPI, (no-arg). , (, no-arg , , Serializeable ), . "" - .

/ (main), : , .

0

main() , .

Static, ,

0

, , - , , . , , .

0

java java .

I am new to java, so please forgive me if my answer is wrong.

0
source

All Articles