Overview
Domain 10 is a single objective with two parts. The first part is implementing localization with locales and resource bundles: building Locale objects, setting the default locale, storing translated text in properties-based bundles, and knowing which bundle file Java selects for a requested locale. The second part is parsing and formatting messages, dates, times and numbers, including currency and percentage values, with MessageFormat, NumberFormat, DecimalFormat and DateTimeFormatter.
Questions usually give a set of bundle files and a default locale and ask which value is printed, or show a formatter and ask for the exact output string. Precision matters, because rounding, grouping separators and the fallback order of bundles decide the answer.
How it's tested
Expect a list of properties files, a default locale and a getBundle call, followed by a request for the printed value. Other items show NumberFormat, DecimalFormat or MessageFormat calls and ask for exact output. Write the candidate bundle names in order before reading the options, since the distractors follow common misreadings.
-
Which bundle wins
Several bundle files exist for languages and countries, and you choose the value returned for a requested locale and a given default locale.
-
Exact formatted output
A number, currency amount, percentage or date is formatted for a locale, and you pick the string printed, including rounding.
-
Parse and fail
A String is parsed with NumberFormat, and you decide whether it returns a value, stops early or throws ParseException.
Bundles Labels.properties and Labels_fr.properties exist, the default locale is en_US, and code requests Locale.of("fr", "CA"). Java first looks for Labels_fr_CA, which is missing, then finds Labels_fr. Keys absent from Labels_fr are taken from the parent Labels.properties. The default locale is consulted only if no French candidate exists, so en_US plays no part here.
Objectives 1
Official objectives from the Oracle outline, in outline order.
10.1 Implement localization using locales and resource bundles. Parse and format messages, dates, times, and numbers, including currency and percentage values.Locale creation, bundle lookup, MessageFormat, NumberFormat, DecimalFormat and localized date-time formatting.
- What it means
- A Locale identifies a language and optionally a country or region. Resource bundles hold locale-specific text, usually in properties files named with a base name and locale suffix, such as Labels_fr_CA.properties. Formatting classes then present messages, numbers, currency, percentages, dates and times in the conventions of a chosen locale, and parse localized text back into values.
- What to understand
- Create locales with constants such as Locale.US, Locale.of("fr", "CA") in Java 19 and later, Locale.forLanguageTag or Locale.Builder; language codes are lowercase and country codes uppercase. Locale.setDefault changes the default, and Locale.Category separates DISPLAY and FORMAT defaults. ResourceBundle.getBundle searches the requested locale, then its language alone, then the default locale's candidates, then the base bundle; a missing key in the chosen bundle is looked up in its parents, and getString throws MissingResourceException when no bundle has it. MessageFormat.format replaces numbered placeholders such as {0}. NumberFormat offers getInstance, getCurrencyInstance, getPercentInstance, getIntegerInstance and getCompactNumberInstance; percent formats multiply by 100 and round to whole numbers by default. parse returns a Number, reads the leading valid portion of a string and throws the checked ParseException when nothing parses. DateTimeFormatter.ofLocalizedDate with a FormatStyle gives locale-aware dates.
- How it shows up
- Expect bundle fallback questions with a changed default locale, percent rounding, currency output and partial parsing.
- Common confusion
- Assuming the default locale is checked before the requested locale's language-only bundle, or that the base bundle is searched first.
High-yield concepts
The terms, rules and formulas this domain turns into questions most often.
-
Locale.of
Factory for language and country locales, added in Java 19.
- Remember
- Locale constructors are deprecated since Java 19.
- Tested as
- Locale creation questions.
- Trap
- Passing a language tag such as fr-CA as the single argument.
-
Bundle search order
Requested locale, its language, default locale candidates, then base.
- Remember
- Stop at the first bundle found.
- Tested as
- Which-value-prints questions.
- Trap
- Checking the default locale too early.
-
Parent bundle inheritance
Missing keys come from more general bundles.
- Remember
- Labels_fr_CA inherits from Labels_fr and Labels.
- Tested as
- Key lookup questions.
- Trap
- Expecting MissingResourceException when a parent has the key.
-
MissingResourceException
Thrown when no bundle or key is found.
- Remember
- It is unchecked.
- Tested as
- Exception questions.
- Trap
- Expecting null to be returned.
-
MessageFormat
Fills numbered placeholders in a pattern.
- Remember
- {0}, {1} refer to argument positions.
- Tested as
- Message output questions.
- Trap
- Using named placeholders.
-
Percent format
Formats a fraction as a percentage.
- Remember
- Multiplies by 100 and rounds to whole numbers by default.
- Tested as
- Exact output questions.
- Trap
- Expecting 0.256 to print as 0.256% or 25.6%.
-
Currency format
Formats an amount with the locale's currency.
- Remember
- en_US prints a dollar sign and two decimals.
- Tested as
- Exact output questions.
- Trap
- Forgetting grouping separators.
-
NumberFormat.parse
Converts localized text to a Number.
- Remember
- Stops at the first invalid character; throws ParseException if none parse.
- Tested as
- Parsing questions.
- Trap
- Expecting an exception for trailing text.
-
Compact number format
Short or long forms such as 1K or 1 thousand.
- Remember
- Uses NumberFormat.Style SHORT or LONG.
- Tested as
- Formatting questions.
- Trap
- Expecting full digits.
-
Localized date styles
FormatStyle SHORT, MEDIUM, LONG and FULL.
- Remember
- Used with ofLocalizedDate and withLocale.
- Tested as
- Date formatting questions.
- Trap
- Expecting the same output in every locale.
Side by side
Concepts candidates mix up, compared on the point that decides the answer.
Locale creation options
| Concept | Meaning | Key difference | Common trap |
|---|---|---|---|
| Locale constants | Ready-made locales such as Locale.US | Only common combinations exist | Assuming every country has a constant |
| Locale.of | Factory taking language and country | Preferred since Java 19 | Using deprecated constructors in new code |
| Locale.forLanguageTag | Parses tags such as fr-CA | Uses a hyphen, not an underscore | Passing fr_CA as a tag |
| Locale.Builder | Fluent builder with validation | Rejects malformed values | Expecting it to accept any string |
Formatting classes
| Concept | Meaning | Key difference | Common trap |
|---|---|---|---|
| NumberFormat | Locale-aware numbers, currency and percent | Factory methods per style | Ignoring default rounding |
| DecimalFormat | Pattern-based number formatting | 0 forces digits; # shows them only if needed | Swapping the meaning of 0 and # |
| MessageFormat | Text with numbered placeholders | Formats arguments for the locale | Using names instead of positions |
| DateTimeFormatter | java.time formatting and parsing | ofLocalizedDate or ofPattern | Using mm for month |
Exam traps
Each trap is an answer that looks right. Learn the clue that should change your mind.
-
Default locale first
- What candidates pick
- Picks the value from the default locale's bundle when a language-only bundle exists.
- Why it looks right
- The default locale feels like the main fallback.
- Why it's wrong
- Java tries every candidate for the requested locale, including language only, before using the default locale's candidates.
Clue to watch for A requested fr_CA with only Labels_fr and Labels_en files present.
-
Missing key means exception
- What candidates pick
- Chooses MissingResourceException when the selected bundle lacks a key.
- Why it looks right
- The chosen file clearly does not contain it.
- Why it's wrong
- Bundles chain to their parents, so the key is found in a more general bundle such as the base file.
Clue to watch for A key defined only in the base properties file.
-
Percent keeps decimals
- What candidates pick
- Expects 0.256 to format as 25.6%.
- Why it looks right
- The value has a meaningful fraction.
- Why it's wrong
- The default percent format rounds to a whole number, so the output is 26%.
Clue to watch for getPercentInstance with no setMaximumFractionDigits call.
-
Parse rejects trailing text
- What candidates pick
- Expects ParseException for a string such as 12.5kg.
- Why it looks right
- The text is not a pure number.
- Why it's wrong
- parse reads the leading valid number and ignores the rest; it throws only when no number appears at the start.
Clue to watch for Input that begins with digits and ends with letters.
-
Underscore language tags
- What candidates pick
- Uses Locale.forLanguageTag with fr_CA.
- Why it looks right
- Bundle filenames use underscores.
- Why it's wrong
- Language tags follow BCP 47 and use hyphens, so fr_CA is not parsed as French Canada.
Clue to watch for A tag string containing an underscore.
Answer framework
Follow these steps for localization questions about bundles or formatting.
- Identify the requested locale and the default locale exactly, including language and country codes, and note any setDefault call.
- List the bundle candidates in search order: requested language and country, requested language, then the default locale's candidates, then the base bundle.
- Select the first bundle that exists, then resolve each key through that bundle's parent chain, reporting MissingResourceException only if no parent defines it.
- For formatting, identify the formatter type and locale, then apply its defaults: percent multiplication and rounding, currency symbol and decimals, grouping separators.
- For parsing, check whether the input starts with a valid number in that locale, since parse stops at the first invalid character or throws ParseException.
Practice question
Want more like this? The 1Z0-830 practice test has questions for every domain.
Checklist
0 of 10
Tick each one you can do without notes. Your ticks stay in this browser.
Study strategy
This is the smallest section, so keep it compact but practical. Create a folder of properties files: a base bundle, a French bundle, a French Canadian bundle and an English bundle, each with some shared and some unique keys. Write a program that changes the default locale and requests different locales, then predict each printed value on paper before running it. Repeat until the search order and parent inheritance feel automatic.
In a second session, practise formatting. Format the same numbers with getInstance, getCurrencyInstance, getPercentInstance and getCompactNumberInstance for Locale.US, Locale.GERMANY and Locale.FRANCE, and note the separators and symbols. Try DecimalFormat patterns with 0 and #, and parse strings with trailing letters and leading letters.
Finish by formatting a LocalDate with each FormatStyle in two locales and using MessageFormat with two arguments. Write a short summary of the bundle search order and default formatter behaviour, and review it before practice tests, since these details fade quickly without revision.
FAQ
How much of 1Z0-830 is Domain 10, Implementing Localization?
Oracle publishes no weight for Implementing Localization. It is one objective, and we plan for about two of the 50 questions, though each needs exact rules.
Should I use new Locale or Locale.of?
Locale constructors were deprecated in Java 19 in favour of Locale.of. Recognise both in code, but prefer Locale.of and the constants.
Do resource bundles have to be properties files?
No. Bundles can also be Java classes extending ListResourceBundle, but properties files are the common case and the main focus of practice questions.
What happens if no bundle matches at all?
If neither the requested locale, the default locale nor the base bundle exists, getBundle throws MissingResourceException, which is an unchecked exception.
Is ParseException checked?
Yes. NumberFormat.parse declares the checked java.text.ParseException, so calling code must catch or declare it.
Does the exam use DateTimeFormatter or SimpleDateFormat?
The objectives centre on the java.time API, so practise DateTimeFormatter with localized styles and patterns rather than the older SimpleDateFormat.
Test your Domain 10 knowledge
You have reviewed locales, resource bundle lookup, message formatting, number, currency and percent formats, parsing and localized dates. See whether you can predict the exact output.
Keep going
- Training Training Built on your Weak areas
- Practice test Questions by domain, with explanations
- Mock exam Full length, timed like the real exam
- Readiness test Find your weakest domain in minutes
- Cheat sheet Key terms and formulas on one page
- Ask the 1Z0-830 AI tutor Get any concept explained your way