tags:

views:

55

answers:

2
public static String fnGetProperty(String ABC)
{
    PropertyResourceBundle configBundle = (PropertyResourceBundle)ResourceBundle.getBundle("ManUtd");
    return configBundle.getString(ABC);
}

Please help me to explain the above codes...Thanks ^^

A: 

I think the docs (PropertyResourceBundle) explain this pretty well. Also, take a look at ResourceBundle for the notion of resource bundles.

bruno conde
A: 

You probably have a set of files called ManUtd.properties (default language), ManUtd_fr.properties (French), ManUtd_de.properties (German), (other language versions) etc. Properties files are a set of key/value pairs; the ResourceBundle class ensures that the appropriate properties file is used for the current Locale.

The cast to PropertyResourceBundle is a dumb thing to do in my opinion. It should be:

ResourceBundle configBundle = ResourceBundle.getBundle("ManUtd");
McDowell