私のプロパティオブジェクトがnullである理由を誰か教えてもらえますか? メソッドに渡す必要がありますか、それとももっと良い方法がありますか? パッケージ間でプロパティ オブジェクトを渡す必要がある場合はどうすればよいですか? ありがとう!
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?
}
}