A browser with JavaScript enabled is required for this page to operate properly.
Documentation

The Java™ Tutorials
Trail: Internationalization
« PreviousTrailNext »

The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.
See Dev.java for updated tutorials taking advantage of the latest releases.
See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.

Lesson: Formatting

This lesson explains how to format numbers, currencies, dates, times, and text messages. Because end users can see these data elements, their format must conform to various cultural conventions. Following the examples in this lesson will teach you how to:

  • Format data elements in a locale-sensitive manner
  • Keep your code locale-independent
  • Avoid the need to write formatting routines for specific locales

Numbers and Currencies

This section explains how to use the NumberFormat, DecimalFormat, and DecimalFormatSymbols classes.

Dates and Times


Version note: This Date and Time section uses the date and time APIs in the java.util package. The java.time APIs, available in the JDK 8 release, provides a comprehensive date and time model that offers significant improvements over the java.util classes. The java.time APIs are described in the Date Time trail. The Legacy Date-Time Code page might be of particular interest.

This section focuses on the DateFormat, SimpleDateFormat, and DateFormatSymbols classes.

Messages

This section shows how the MessageFormat and ChoiceFormat classes can help you solve some of the problems you might encounter when formatting text messages.

« PreviousTrailNext »

Previous page: Previous Lesson
Next page: Numbers and Currencies

AltStyle によって変換されたページ (->オリジナル) /