Timestamp[] lastreply = new Timestamp[100];
replyr = lastreplyr[i].getTime();
System.out.println("Replyr: "+replyr);
lastreply[count].setTime(replyr);
System.out.println("lastreply: "+lastreply[count]);
Console:
Replyr: 1321116689000
java.lang.NullPointerException
at website.web.InboxReader.getLastReply(InboxReader.java:937)
at website.web.InboxReader.main(InboxReader.java:55)
Why is lastreply getting null? In the code, count begins from 0.
Thanks.
This is the problem:
lastreply[count]is null, because Timestamp is an object.When you instantiate an array of objects then all the values are
null. You need to insert references to objects first before start using them.