Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Inheritance and ArrayList

843785Aug 3 2008 — edited Aug 3 2008
I am working on a natural-language processing system in Java. The first step of my approach is to "parse" a sentence and create a representation of it in Java(i.e. "large" would correspond to an object of class large). The issue is that I basically want to create an ArrayList that contains Java's representation of the sentence, which, for the example sentence "a large cat is sitting on my bed" would contain objects of type "large", "cat", "sit", "my", and "bed". Since an ArrayList can only hold one type of object, could I create a "sentence" class that was extended by all of the individual concept classes, and make the ArrayList be that class?(While still being able to use methods in the child classes)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 31 2008
Added on Aug 3 2008
5 comments
259 views