the value memanufacturer is retrieved from xml document using jdom and when this value is assigned to meman array it throws NullPointerException.
Element memanufacturer = (Element) row27.get(j9);
meman[0] = memanufacturer.getValue();
what could be the posssible mistake.
Thanks
Assuming the exception by the second line of code, there are two obvious possibilities:
memanufacturer
may be nullmeman
may be nullWe can't tell which of these is the case, but you should be able to.
EDIT: Okay, so now we know that
meman
is null, that's the problem. I would suggest you use aList<String>
instead:Using a
List<String>
instead of an array means you don't need to know the size before you start.However, the fact that you didn't understand the error suggests you should really read a good introductory Java book before going any further with a real project. You should definitely understand how arrays, collections etc work before dealing with XML and the like. It will save you a lot of time in the long run.