• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ResourceBundle instance

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following question is from a mock exam.

Which is the correct way of creating a ResourceBundle instance?
Note: consider “SRBundel” and “SRBundel_de” are subclasses of the ListResourceBundle class.

Please select 1 option:

A. Locale loc = new Locale("de");
ResourceBundle rb = ResourceBundle.getBundle("SRBundel_de", loc);
B. ResourceBundle rb = new ResourceBundle ("SRBundel");
C. ResourceBundle rb = new ResourceBundle ("SRBundel_de", loc);
D. ResourceBundle rb = ResourceBundle.getBundle("SRBundel.class");
E. None of above.



I selected the Answer A and the solution says Answer D.

Any feedback would be appreciated.

 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A is incorrect because the bundle name includes the locale which shouldn't be there

ResourceBundle.getBundle("SRBundel_de", loc)

As for D, it seems incorrect to me as it includes ".class" in the bundle name, I don't see in documentation that you should include ".class" in the bundle name but I've not tried and maybe it works...
 
reply
    Bookmark Topic Watch Topic
  • New Topic