Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8027287

(fmt) incorrect example in Formatter javadoc

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P5
    • 8
    • 6, 7, 8
    • core-libs
    • b115
    • Verified

    Description

      The last example before the "Organization" section in the class doc is incorrect. The example, with imports elided, is:

          Calendar c = new GregorianCalendar(1995, MAY, 23);
          String s = String.format("Duke's Birthday: %1$tm %1$te,%1$tY", c);
          // -> s == "Duke's Birthday: May 23, 1995"

      Instead, to match the output shown, it should probably be this:

          Calendar c = new GregorianCalendar(1995, MAY, 23);
          String s = String.format("Duke's Birthday: %1$tb %1$te, %1$tY", c);
          // -> s == "Duke's Birthday: May 23, 1995"

      That is, the %1$tm conversion should be %1$tb, and a space should be added after the comma.

      (Filed on behalf of joe.bowbeer@gmail.com)

      Attachments

        Activity

          People

            smarks Stuart Marks
            smarks Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: