Results 1 to 7 of 7
Thread: who can i do it ?
- 07-21-2008, 04:01 PM #1
Member
- Join Date
- Jun 2008
- Posts
- 48
- Rep Power
- 0
- 07-21-2008, 04:09 PM #2
An array is a collection of same type elements. What do all the items you want to store in an array have in common? That would be the type of the array. Since there they have nothing in common, you can't store them in an array: int and double are primitives, String is a class. If you use Integer and Double then all the elements would be Objects and you could store them in Object[] array.
- 07-21-2008, 04:23 PM #3
Member
- Join Date
- Jun 2008
- Posts
- 48
- Rep Power
- 0
Norm could u pls give me a simple example of object array with
with diff. data types in the class ... i just need a small example..
- 07-21-2008, 04:29 PM #4
Object[] array = new Object[2];
array[0] = "First";
array[1] = new Integer(2);
- 07-21-2008, 04:34 PM #5
Ya, that was a nice solution norm.
Shyam you can even use array of arrays. An array having arrays of different data type.To finish sooner, take your own time....
Nivedithaaaa
- 07-21-2008, 04:49 PM #6
Member
- Join Date
- Jun 2008
- Posts
- 48
- Rep Power
- 0
hi Norm
can i do it by using Vector class . i hav a example of vector class i m tring with that.
if u hav a ex. of object array prog. pls give me one. that will be really helpfull.
thanks
- 07-21-2008, 04:53 PM #7
Member
- Join Date
- Jun 2008
- Posts
- 48
- Rep Power
- 0


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks