How static tool methods call non-static variables

Existing variable Double a (read from configuration file)

How to call variable a in the static tool method func1???

 

In theory, static methods cannot call non-static variables

 

If this is the case, my method is:

Read the content of the configuration file in other files, and then pass it as a parameter to func1

eg: declare func(Double a)

Call DistanceUtils.func(a)

 

other

https://blog.csdn.net/qq_38243970/article/details/80884280?ops_request_misc=&request_id=&biz_id=102&utm_term=@autowire%E6%B3%A8%E9%87%8A%E9%9D%99%E6%80%81%E5%8F%98%E9%87%8F%20%E5%8A%A0%E8%BD%BD%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-80884280.first_rank_v2_pc_rank_v29_10

Guess you like

Origin blog.csdn.net/qq_24271537/article/details/114887464