+ 1
Data structure. Vector
Can I add more than one type in same vector. Java ???
1 Respuesta
0
yes!
It is only if the type which you are adding is subtype of vector type.
Let's take a class `Number` it is super class of `Integer` and `Double`. so if you were to create a vector with `Number` as it's type then, each element in that vector is a `Number` or subtype of `Number`.
Note: Sub class can be assigned to super class' instance