enter code hereI am new to Java, i have a class "RSTrule" with class variable "private ArrayList nucleusType". I want to set values to this arraylist in another class namely "RSTRules"
i use the following code:
public class RSTRule{
private ArrayList<Type> nucleusType;
}
public class RSTRules extends ArrayList<RSTRule> {
public RSTRule generateSimilarSentence()
{
RSTRule rstRule=new RSTRule();
rstRule.setNucleusType(.....)
return rstRule;
}
}
i have two or three values for nucleus array. for example I want to add "UMM" and "UMNM" to nucleus array list in a short form. how can i do that?
ArrayList<RSTRule>.ArrayList<E>, you should use composition over inheritance.