What does a static method / variable really refer to in java if the object has not been initialized?

I understand the main differences between static and instances, but I was interested in this for my final CS, as it is not included in our book: what is your code really referencing when you call the static method?

FooClass.staticMethod();

I assume that it should initialize the class and then call the method, but that would mean that it is not static, because it still refers to the object, not the class. Any explanation is appreciated as I really want to better understand this topic and thanks in advance

+4
source share
1

FooClass , , Java, staticMethod. , , , ( , FooClass.class), , staticMethod . . this .

(, - .)

+3

Source: https://habr.com/ru/post/1663603/


All Articles