Use getBundle(String baseName) to load resource file


import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class MainClass {
  public static void main(String args[]) throws Exception {
    ResourceBundle resources;

    try {
      resources = ResourceBundle.getBundle("MyData");
      System.out.println(resources.getString("Hi"));
    } catch (MissingResourceException mre) {
      System.err.println("MyData.properties not found");
    }
  }
}

//File: MyData.properties
/*
Hi = Hello World!
*/


//File: MyData_fr.properties
/*
Hi = Salut tout le monde!
*/
Home 
  Java Book 
    Essential Classes  

ResourceBundle:
  1. The ResourceBundle, ListResourceBundle, and PropertyResourceBundle Classes
  2. Use getBundle(String baseName) to load resource file
  3. Use getBundle(String baseName, Locale locale) to load resource based on Locale information
  4. getString(String key) load the value by the key