Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Errata page 381 OCA OCP Test guide (Jeanne and Scott) - Localization

 
Ranch Hand
Posts: 75
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys. This is a errata of the book OCA/OCP JAVA SE8 Programmer Practice Test by Jeanne and Scott.

Answer's book:
B. Since no locale is specified, the code tries to find a bundle matching the default locale. While none of the resource bundles match English United States, two do match the language English. The Java class one is used since it is present. Since the Java resource bundle for English doesn’t have a key wheels , we go up to the parent resource bundle. The default Java resource bundle does have the key wheels with the value 4 , so Option B is correct.

Right answer: Option C Because by not matching with Buggy_en.java for not having found the key "wheels", it will continue with Buggy_en.properties (default locale is en_US) so in this file it can find that key and retrieves its value.

I checked it compiling it.
20191105_202921.jpg
[Thumbnail for 20191105_202921.jpg]
 
author & internet detective
Posts: 39586
781
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this is so similar to your other thread, let's keep the discussion in that one.
 
Wait for it ... wait .... wait .... NOW! Pafiffle! A perfect tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!