Which code inserted on line 1 will accomplish this?

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);

Download Printable PDF. VALID exam to help you PASS.

One thought on “Which code inserted on line 1 will accomplish this?

  1. 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.

  2. 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

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.