Java – a good programming practice for static initialization?
•
Java
In Java, we use static initialization blocks:
private static final ApiKey API_KEY; static { API_KEY = new ApiKey(); }
Solution
To some extent, it's a matter of taste For me, as long as there are the following advantages: @ h_ 502_ 4@ you keep the last position as you do
private static final ApiKey API_KEY = new ApiKey();
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码