I have an List array 'details'.
List<HistoryDetails> details
where HistoryDetails is an object containing strings.
When I check the size it gives me a positive value.
details.size()
But when I try to access an element it throws a null pointer exception.
details.get(0).getFirstElement();
Attempt to invoke virtual method 'java.lang.String com.HistoryDetails.getFirstElement()' on a null object reference
I am invoking the element at the very next line to where I check the size. Hence, nothing should be reset. What could be wrong?
Aucun commentaire:
Enregistrer un commentaire