exam questions

Exam 1z0-819 All Questions

View all questions & answers for the 1z0-819 exam

Exam 1z0-819 topic 1 question 19 discussion

Actual exam question from Oracle's 1z0-819
Question #: 19
Topic #: 1
[All 1z0-819 Questions]

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);
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
dbb65b4
5 months, 1 week ago
Selected Answer: A
Tested, A. A is correct because it has the complete path for messages compared to others which doesn't have a complete path for the messages which will result to "Can't find bundle for base name" error
upvoted 2 times
...
d7bb0b2
1 year ago
Selected Answer: D
A is not valid first argument must be qualified name . all other are ok.
upvoted 1 times
...
ASPushkin
1 year, 3 months ago
A,C,D A is also correct. see spec : "Note:The baseName argument should be a fully qualified class name. However, for compatibility with earlier versions, Sun's Java SE Runtime Environments do not verify this, and so it is possible to access PropertyResourceBundles by specifying a path name (using "/") instead of a fully qualified class name (using ".")."
upvoted 2 times
...
Omnisumem
1 year, 4 months ago
Selected Answer: C
Tested. No answer is correct. A, B and D because of line "String[] names = "Joe", "Jane");" - compilation failed. C is almost correct if we put: String message = MessageFormat.format(message.getString(“message”),“Joe”,“Jane”); instead of: String message = MessageFormat.format(msg.getString(“message”),“Joe”,“Jane”);
upvoted 3 times
...
eldonivan
1 year, 5 months ago
C is correct. there are syntax errors on the others (closing parenthesis). .... "Joe","Cane")
upvoted 2 times
...
MSPORD
1 year, 8 months ago
Selected Answer: D
D is the correct answer if you have your language set properly
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago