Release Note: Console Methods With Explicit Locale

XMLWordPrintable

    • generic
    • generic

      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
      ```

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

              Created:
              Updated:
              Resolved: