benito kamelas wrote:Could you be more specific on the system print and how does it find the bugs? I mean, I know what its for but didn't know it worked as a debugger.
System.out.println (S.o.p) doesn't find bugs. Your BRAIN finds them. S.o.p just helps you see what is really happening so you can understand.
What I will often do is put in a statement just before each loop starts, and print out the value I'm about to test (this doesn't work on a for-loop, but will for a while).
Then, the first statement in the loop will again be the value. So just before your line 72, i'd do something like:
Before each if-statement in your loop, print nNumber and nProductX (which will be easier one you have an array). Then you can see what the values are, and why it is or isn't entering the if-statement.