Query about simulating global variables in java

前端 未结 2 962
孤独总比滥情好
孤独总比滥情好 2021-01-07 15:45

I have a question and i suppose this is trivial for most around here. However, here goes -- I have an application that connects to a database to read specific information.

2条回答
  •  攒了一身酷
    2021-01-07 16:11

    You can instantiate those static variables in static method of global, instead of constructor But this is not a good style:

    static initialize(DBAccessInput input) {
         a = ...
         b = ...
    }
    

提交回复
热议问题