optimization - Java: is it possible to set values of an uninitialized class using final? -
take next illustration class:
public class globalexample{ static int width; static int height; static int size; }
the class members can accessed / initialized separate class using:
globalexample.width = 1
however, if wanted create variables final (which understand makes things more efficient when programme accessing variables lot) can no longer initialized externally, can't seem initialized within class outside of constructor. since globalexample never initialized itself, constructor wouldn't run.
my question whether there way initialize final variables within class.
alternately, barking wrong tree efficiency-wise? more efficient create instance of variablepackage class , pass 1000000 function calls?
thanks
are unable initialize them when declare them?
public class globalexample{ final static int width = 1; final static int height = 5; final static int size = 100; }
if have modify them dynamically, perhaps final
not suitable here.
java optimization
No comments:
Post a Comment