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

Typo in Answer to Questions and Exercises: Generics

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • None
    • None
    • docs
    • None

      In http://docs.oracle.com/javase/tutorial/java/generics/QandE/generics-answers.html

      11. Consider this class:

      class Node<T> implements Comparable<T> {
          public int compareTo(T obj) { /* ... */ }
          // ...
      }

      Will the following code compile? If not, why?

      Answer: Yes.

      Node<String> node = new Node<>();
      Comparable<String> comp = node;

      ==============

      Move "Answer: Yes." to the end of the item.

            bhoran Bernard Horan (Inactive)
            rgallard Raymond Gallardo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: