facebook

Generic ArrayList not working.

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #258933 Reply

    k_chaaya
    Member

    Hi,
    I went through a lot of similar posts and followed the instructions therein but still couldn’t get this to work…Therefore posting…
    The following line in Eclipse 3.1

    ArrayList<JTextField> textboxes = new ArrayList<JTextField>();

    gives the compiler error:

    The type ArrayList is not generic; it cannot be parameterized with arguments <JTextField>

    My java version is “1.5.0_01”

    In Eclipse,
    The Window > Preferences > Java > Compiler > Compliance and ClassFiles has the compiler level set to 5.0
    Generated .class files compatibility set to 5.0
    Source compatability set to 5.0

    In Project > Properties > Java Compiler > Compliance and Classfiles also, the above three fields are set to 5.0..

    Still, I am getting the above error…

    Why can this be????

    #258972 Reply

    Riyad Kalla
    Member

    Moving to OT > Soft Dev

    Your code is valid, just make sure your import is for java.util.ArrayList, you might have accidentally imported some other ArrayList.

    #259147 Reply

    k_chaaya
    Member

    Hi,
    Thanks for replying… I had imported java.util.ArrayList… No other…..
    Don’t have an idea where was the problem.. But i installed eclipse again and then ran the code… It worked!!..
    Anyways, thanks..

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Generic ArrayList not working.

You must be logged in to post in the forum log in