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

Reporting minor syntax issue.

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      While I am reading the Documation on Generics topic (Interoperating with Legacy Code) in official page. I found a minor syntax issue on creating LinkedList object. please find the link of document and the piece of code which has error below.

      https://docs.oracle.com/javase/tutorial/extra/generics/legacy.html

      public String loophole(Integer x) {
          List ys = new LinkedList; //error line missing parenthesis
          List xs = ys;
          xs.add(x);
          return(String) ys.iterator().next(); // run time error
      }


            rgallard Raymond Gallardo
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: