java - Currency class only one instance per currency? -


from this official oracle java tutorial:

note currency class designed there never more 1 currency instance given currency. therefore, there no public constructor. demonstrated in previous code example, obtain currency instance using getinstance methods.

what risk of having more 1 instance of currency given currency? in advance.

refer link currency

representation of currency particular locale. each currency identified iso 4217 code, , 1 instance of class exists per currency. result, instances created via getinstance() methods rather using constructor.

as java doc says can supersede java runtime currency data creating properties file named <java_home>/lib/currency.properties. contents of properties file key/value pairs of iso 3166 country codes , iso 4217 currency data respectively. value part consists of 3 iso 4217 values of currency, i.e., alphabetic code, numeric code, , minor unit. 3 iso 4217 values separated commas. lines start '#'s considered comment lines. example,

sample currency properties

jp=jpz,999,0

will supersede currency data japan.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -