谁能告诉我为什么我的属性对象为空?我必须将它传递给方法,还是有更好的方法?如果我需要在包之间传递我的属性对象怎么办?谢谢!
public class Test {
private Properties properties = null;
public static void main (String[] args) {
testObject = new Test();
Properties properties = new Properties(); // Then load properties from fileInputStream sucessfully
utilityMethod();
}
private void utilityMethod() {
properties.getProperty("test"); // Why do I get a null pointer exception?
}
}