I'm supposed to instantiate an object by passing a double array containing values and invoke some methods and the results should come out on the console. My code:
public class Client {
public static void main(String[] args) {
RainLog log = new RainLog(1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0);
double[] inRangeValues = log.getInRange(0,0);
for(int i=0; i<inRangeValues.length; i++)
System.out.println(inRangeValues[i]);
}
}
after running this appears on the console:
Exception in thread "main" java.lang.NullPointerException
at comp125.RainLog.getInRange(RainLog.java:73)
at comp125.Client.main(Client.java:7)
I click on:
at comp125.RainLog.getInRange(RainLog.java:73)
it directs me to my loop:
for(int i=0; i<data.length; i++)
which passed the JUnit test which I am not sure why. I am new to java and programming so not really sure where the problem is at.