Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8330276 Console methods with explicit Locale
  3. JDK-8331014

Release Note: Console Methods With Explicit Locale

    XMLWordPrintable

Details

    • generic
    • generic

    Description

      The following methods have been added to `java.io.Console` class that take a `java.util.Locale` argument:
         - `public Console format(Locale locale, String format, Object ... args)`
         - `public Console printf(Locale locale, String format, Object ... args)`
         - `public String readLine(Locale locale, String format, Object ... args)`
         - `public char[] readPassword(Locale locale, String format, Object ... args)`

      Users can now output the string or display the prompt text formatted with the specified `Locale`, which may be independent of the default locale. For example, a snippet `System.console().printf(Locale.FRANCE, "%1$tY-%1$tB-%1$te %1$tA", new Date())` will display:
      ```
      2024-mai-16 jeudi
      ```

      Attachments

        Activity

          People

            naoto Naoto Sato
            naoto Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: