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

Wrong code in official documentation : Instant Class

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • 8
    • docs
    • generic
    • generic

      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

            bhoran Bernard Horan (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: