Java SE 8 Programmer II — Question 45
You have been asked to create a ResourceBundle which uses a properties file to localize an application.
Which code example specifies valid keys of menu1 and menu2 with values of File Menu and View Menu?
Answer options
- A. <key name = ‘menu1">File Menu</key> <key name = ‘menu2">View Menu</key>
- B. <key>menu1</key><value>File Menu</value> <key>menu2</key><value>View Menu</value> menu1, File Menu, menu2, View Menu Menu C.
- D. menu1 = File Menu
Correct answer: B
Explanation
Option B is correct because it uses the correct structure for defining keys and values in a ResourceBundle format. The other options either have incorrect syntax or do not follow the required format for key-value pairs.