ListResourceBundle.getContents() has the following syntax.
protected abstract Object [][] getContents()
In the following code shows how to use ListResourceBundle.getContents() method.
// w w w . jav a 2s.com import java.util.*; class MyResources extends ListResourceBundle { protected Object[][] getContents() { return new Object[][]{ {"hello", "from java2s.com"}, {"client", "HTML"}, {"server", "PHP"} }; } } public class Main { public static void main(String[] args) { MyResources mr = new MyResources(); // print the string for key hello System.out.println(mr.getString("hello")); } }
The code above generates the following result.