Consider the following program:
import java.util.*; public class ResourceBundle_it_IT extends ListResourceBundle { public Object[][] getContents() { return contents; }//from w w w . j a v a2 s . c o m static final Object[][] contents = { { "1", "Uno" }, { "2", "Duo" }, { "3", "Trie" }, }; public static void main(String args[]) { ResourceBundle resBundle = ResourceBundle.getBundle("ResourceBundle", new Locale("it", "IT", "")); System.out.println(resBundle.getObject(new Integer(1).toString())); } }
Which one of the following options correctly describes the behavior of this program?
a)
This program correctly extends ListResourceBundle and defines a resource bundle for the locale it_IT.
The getObject()
method takes String as an argument; this method returns the value of the matching key.
The expression new Integer(1).toString()
is equivalent of providing the key "1", so the program prints Uno in output.