Why static method can not directly access non-static method?

Static methods belong to the class that the static method is loaded with class and loaded when loading classes, the program will allocate memory for the static methods
non-static method belongs to the object, the object is created after the class load
static method before the object exists, so if a static method call non-static methods, it may be reported to a null pointer exception.

Guess you like

Origin www.cnblogs.com/yuanjl/p/11041922.html