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

Wrong code in official documentation : Instant Class

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: None
    • Component/s: docs
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      A DESCRIPTION OF THE PROBLEM :
      In the link https://docs.oracle.com/javase/tutorial/datetime/iso/instant.html, there's the following example:

        Instant oneHourLater = Instant.now().plusHours(1);

      The same page says (on the top): "The Java Tutorials have been written for JDK 8."

      But in JDK 8, the java.time.Instant class doesn't have the plusHours method.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Instant oneHourLater = Instant.now().plus(1, ChronoUnit.HOURS);
      ACTUAL -
      Instant oneHourLater = Instant.now().plusHours(1);

      URL OF FAULTY DOCUMENTATION :
      https://docs.oracle.com/javase/tutorial/datetime/iso/instant.html

        Attachments

          Activity

            People

            Assignee:
            bhoran Bernard Horan
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: