How to solve "Exception in thread "main" java.lang.NullPointerException" -
this question has answer here:
- what nullpointerexception, , how fix it? 12 answers
i'm supposed instantiate object passing double array containing values , invoke methods , results should come out on console. 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 appears on console:
exception in thread "main" java.lang.nullpointerexception @ comp125.rainlog.getinrange(rainlog.java:73) @ comp125.client.main(client.java:7)
i click on:
at comp125.rainlog.getinrange(rainlog.java:73)
it directs me loop:
for(int i=0; i<data.length; i++)
which passed junit test not sure why. new java , programming not sure problem at.
data
null @ line 73 of rainlog.java.
there must somethiing wrong junit test if passed without detecting bug.
Comments
Post a Comment