Given:
and
and
You want to print the message ????? Joe, ?????????, Jane.
Which code inserted on line 1 will accomplish this?
A. ResourceBundle msg = ResourceBundle.getBundle(“/proj/msg/messages”, new Locale(“ja”,”JP”)); Object[] names = “Joe”, “Jane”); String message = MessageFormat.format(msg.getString(“message”),names);
B. ResourceBundle msg = ResourceBundle.getBundle(“msg.messages”, Locale.JAPAN); Object[] names = “Joe”, “Jane”); String message = MessageFormat.format(msg.getString(“message”),names);
C. Locale.setDefault(Locale.JAPAN);
ResourceBundle messages = ResourceBundle.getBundle(“messages”);
String message = MessageFormat.format(msg.getString(“message”),”Joe”,”Jane”);
D. ResourceBundle msg = ResourceBundle.getBundle(“messages”, Locale.JAPAN); String[] names = “Joe”, “Jane”); String message = MessageFormat.format(msg.getString(“message”),names);
1st param of getBundle method is baseName, which is ‘messages’ in this scenario. So A and B do not fit.
C has compiler error – ‘msg’ instead of ‘messages’. D is the right option.
D
I think,
B
But, “A” could also be answer if “/proj” folder is not the base folder
i.e. if it is subfolder of “src” as /src/proj/msg/messages