Search:

Type: Posts; User: KevinWorkman

Search: Search took 0.09 seconds.

  1. Replies
    14
    Views
    3,694

    Re: Please help ArrayList Question

    It depends what you mean by "elements". Objects can be elements in an array or an ArrayList. But if you mean "primitives" instead of "elements" then yeah, Objects and primitives are different.
  2. Replies
    14
    Views
    3,694

    Re: Please help ArrayList Question

    Like I said, arrays definitely CAN contain primitives, but they don't HAVE to. They con contain Objects as well. So to say the can only contain a single data type is not correct. I don't want to be...
  3. Replies
    14
    Views
    3,694

    Re: Please help ArrayList Question

    I'm still not sure I agree with that. Arrays definitely can contain primitives (whereas ArrayLists can only contain Objects, including wrapper classes for primitives). But arrays can also contain...
  4. Replies
    14
    Views
    3,694

    Re: Please help ArrayList Question

    I just woke up and I haven't tested this, but couldn't you store multiple types in an array by doing something like this:

    Object[] objs = {new Object(), "cats", 7};
  5. Replies
    14
    Views
    3,694

    Re: Please help ArrayList Question

    An ArrayList is an Object that holds a variable amount of other Objects.

    An array is a container that holds a fixed number of Objects or primitives.

    They aren't the same, and what you've...
  6. Replies
    14
    Views
    3,694

    Re: Please help ArrayList Question

    That's an array, not an ArrayList.
Results 1 to 6 of 6