Dead loop of Java non static member variables (detailed explanation)
1. Non static member variable
翻译错误 TIMEOUT
example:
result:
Analysis: when new constructorcls() instantiates constructorcls, then initializes the member obj of this class, and obj instantiates its own class. This continues until stackoverflowerror
2. Static member variables
Static member variables belong to classes, and there will be no dead loop
For example:
Analysis: when new constructorcls(), first add constructorcls to the JVM, initialize the static members of this class during loading (only once during loading), initialize the obj object, and new a constructorcls. A key point here is that this static member belongs to a class and does not belong to an instance object, so no dead loop will be generated.
The above is all the content of the Java non static member variable dead loop (detailed explanation) brought by Xiaobian. I hope you like it~
If you want to know more about game activities and game strategies, please continue to pay attention to this site. This site will bring you the best, most fun and freshest game information at the first time. More exciting content in jb51 game channel!