Menu

ArrayList

2007-12-28
2013-04-09
  • brixtondawg

    brixtondawg - 2007-12-28

    Hello, i have been following the Eclipse Java Tutorial and it has been very enlightening but now i am in a quandary. In tutorial 9, it instructs that i enter 'ArrayList<String> list = new ArrayList<String>();' i did this and it just does not work the same way as it appears in the video. i then have to remove the <String> for me to continue. this puzzles me.

    Can anyone please explain why this is the case for me?

    Thanks

     
    • Mark Dexter

      Mark Dexter - 2007-12-28

      Hello. Can you please check what version of the JRE you are running? One possible explanation is that you are running version 1.4 and not 1.5. You can tell this by opening Eclipse and selecting Window / Preferences / Java / Installed JRE's. The JRE version should be 1.5 or 1.6. Java Generics, which this example uses, were introduced in Java 1.5.

      Please let me know what you find. Thanks. Mark

       
      • Frej

        Frej - 2008-02-29

        I had the same problem even though I have java 1.6 installed. But I solved the problem by changing compiler compliance level to 6. It can be found in Window > Preferences > Java > Compiler.

         

Log in to post a comment.