I have a value in Java that is always null but I don't understand why, because I am setting the value of the variable using the class constructor.
I have code like such:
Driver driverClass = new Driver("<file path redacted>");
And then the below:
String cfgFilePath;
public Driver(String cfgFile) {
this.cfgFilePath = cfgFile;
}
private ArrayList<String> keys = getKeys(cfgFilePath);
private String a1 = keys.get(0);
private String b1 = keys.get(1);
For some reason, IntelliJ IDEA says that cfgFilePath is always null. I am initializing it with the Driver class constructor, so why is it null? When I run the program I get a null pointer exception.