6 Replies Latest reply: Jul 24, 2013 4:21 AM by PhHein RSS

    ArrayList question - can add String but not int

      I"m a little confused on something with ArrayLists. I'm trying to add an int to the ArrayList
      Suppose I have:

      int myInt = +<some value>+
      String myString = +<some value>+
      ArrayList myAL= new ArrayList(0);

      However, when I compile (using java 1.4.2), I get a compile error for the method add when it's passed an int, so I have to do this instead:


      Is there some way I can store these integer value in my ArrayList as int's without converting them to String?