I have a private int array, and I need to somehow find the length but I cannot do this under the static class. I have to keep the class static, is there another method I can add to change a.length to something else?
The issue is caused by a.length.
private int [] a;
public static IntegerSet union(IntegerSet otherSet, IntegerSet nextSet) {
for(int i=0; i<a.length; i++) {
if (otherSet.isSet(i))
nextSet.insertElement(i);
}
return nextSet;
}
As i said use
and change your method to