【发布时间】:2012-12-04 06:04:55
【问题描述】:
我有一个私有 int 数组,我需要以某种方式找到长度,但我不能在静态类下做到这一点。我必须保持类静态,是否可以添加另一种方法来将 a.length 更改为其他内容?
问题是由 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;
}
【问题讨论】:
标签: java string-length