Inheritance and ArrayList
843785Aug 3 2008 — edited Aug 3 2008I 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)