Home > Back-end >  To ask, why a static method in the main body is instantiated when not be invoked, but did initialize
To ask, why a static method in the main body is instantiated when not be invoked, but did initialize

Time:02-27

The main method

PostConstruct, an approach to modify the init () method

The results

Because from the calling sequence should be constructed - "autowired -" postconstruct this order, and then initialize the class when the static method should be performed first right? But the results didn't perform static method, consult the great god that is why,,,

CodePudding user response:

A static method does not call how can perform

CodePudding user response:

Why getCommonNo () static method performs initialization? You did initialize static variables, because class initialization, you can put the static block and confused, static static methods to communicate in doubt

CodePudding user response:

Later. Indeed, switch to direct new method getCommNo () to go, but strangely, use a t or t1 to., IDEA provides no getCommNo in lenovo method (), can oneself complete knocked out...

CodePudding user response:

reference a2236403460 reply: 3/f
indeed, switch to direct new methods later. GetCommNo () to go, but strangely, use a t or t1 to., IDEA provides no getCommNo in lenovo method (), can oneself complete knocked out...
can call static methods directly using the class name
  • Related