Results 1 to 6 of 6
Thread: Object array query
- 01-07-2008, 09:20 AM #1
Senior Member
- Join Date
- Nov 2007
- Posts
- 111
- Rep Power
- 0
- 01-07-2008, 10:30 AM #2
It's simple forward thing if you only want TagIt then do something like this ..
There is nothing Generics associated with it.Java Code:TagIt tagItArray = new TagIt[5] ;
dont worry newbie, we got you covered.
- 01-07-2008, 12:49 PM #3
Senior Member
- Join Date
- Nov 2007
- Posts
- 111
- Rep Power
- 0
Thanks but I want it to only store objects of child classes of my custom class "TagIt". Which means:
TAGIt has 3 classes that inherit from TAGIt. I want to store the objects of these classes in the array.
- 01-07-2008, 01:50 PM #4
The answer that Roots gave will do exactly that for you. The declaration they gave means that only objects of type TagIt or any of its subclasses will be allowed to be put in the array. Attempts to put any other type in it will fail.
- 01-07-2008, 02:43 PM #5
Abstract class
Hello bugger.
If you make TagIt an abstract class, then you cannot put an instance of that class into your array - only its non-abstract sub classes.
It does the same as what jelly and roots suggested, but it will exclude TagIt.
Originally Posted by bugger
Hope this helped. ;)Eyes dwelling into the past are blind to what lies in the future. Step carefully.
- 01-07-2008, 05:58 PM #6
Similar Threads
-
Operator < cannot be applied to java.lang.Object, Object
By Albert in forum Advanced JavaReplies: 2Last Post: 11-26-2010, 02:12 AM -
Need help with creating array of type object
By riz618 in forum New To JavaReplies: 3Last Post: 01-29-2008, 06:14 AM -
Using sql:query tag
By Java Tip in forum Java TipReplies: 0Last Post: 01-15-2008, 03:13 PM -
how to remove an object from the array list
By cecily in forum New To JavaReplies: 3Last Post: 08-02-2007, 02:26 PM -
Creating object of Type Object class
By venkatv in forum New To JavaReplies: 3Last Post: 07-17-2007, 03:33 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks