T
Tony Johansson
Hello!
Assume I create an ArrayList like this
ArrayList arraylist = new ArrayList();
Now to my questions:
1. Does this mean that all the elements that is added to the arraylist is of
type object and is referencing the actual added elements ? Is this correct?
2.So assume I have three elements in the arraylist consisting of three
different types.
The first added element to arraylist is a class type which is called
clock( Reference type)
The second added element is value type for example an int which is boxed.
(Value type)
The third added element is string.(Reference type)
So now I have three elements of type object in the arraylist. I call these
three element
object 1, object2 and object3
Now object1 is referencing the clock object
object2 is referecing the boxed int
object3 is referencing a string object.
Can you just correct me if I'm wrong at some point in the above description
?
//Tony
Assume I create an ArrayList like this
ArrayList arraylist = new ArrayList();
Now to my questions:
1. Does this mean that all the elements that is added to the arraylist is of
type object and is referencing the actual added elements ? Is this correct?
2.So assume I have three elements in the arraylist consisting of three
different types.
The first added element to arraylist is a class type which is called
clock( Reference type)
The second added element is value type for example an int which is boxed.
(Value type)
The third added element is string.(Reference type)
So now I have three elements of type object in the arraylist. I call these
three element
object 1, object2 and object3
Now object1 is referencing the clock object
object2 is referecing the boxed int
object3 is referencing a string object.
Can you just correct me if I'm wrong at some point in the above description
?
//Tony