![]() |
[JAVA] java.lang.NullPointerException
Ok guys, i've got some new code ready for ya...
Code:
java.lang.NullPointerException Code:
public ProductSpecification getSpecification(String itemCode) Code:
public boolean enterItem(String upc, int quantity) Code:
case 1 : // Event 1 - Enter Item Thank you all very much!! -BoltedDown |
productSpecifications
in your first set of code. Is this a class variable? because it doesn't seem to exist anywhere else in your code. |
I would guess you're calling getItemID() on an uninitialized (NULL) member of the productSpecifications array. I don't know the extent of your program, but a HashMap object might be better suited for your list of ProductSpecifications rather an an array, ArrayList, or whatever you're using to index it.
Also, as a tip, you can use the "break;" command in that for loop so you don't have to use a boolean flag. It simply breaks out of the inner most loop. |
Out of curiosity, why not do this?
Code:
public ProductSpecification getSpecification(String itemCode) |
All times are GMT -8. The time now is 08:08 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project