我正在尝试使用类变量(向量)并得到以下 2 个错误
1
<identifier> expected [javac] bucketList = AppConfig.findVector (BUCKET_LIST_KEY);
2 在getBucketList()
方法中,bucketList
由于某种原因是 null ......即使它被定义为类的全局变量。
代码
import java.util.Vector;
public class MyClass {
...
private Vector<String> bucketList;
public ThingieConfig() throws IOException {
@SuppressWarnings("unchecked")
bucketList = AppConfig.findVector (BUCKET_LIST_KEY);
if (bucketList != null && !bucketList.isEmpty()) {
log_.debug ("Bucketlist defined");
log_.debug("Buckets Defined : " + bucketList);
}//if
}//thingie
public Vector getBucketList() {
log_.debug ("Returning Vector " + bucketList);
return bucketList;
}//getBucketList
}//class