General Tips
Techniques to debug programs differ depending on the programming language in question. For all programming languages though, knowing what values the variables hold and at what point during your program execution is the most important factor in understanding how to fix a bug. For java System.out.println( ); is the tool of choice to print out variables and discover errors.
Use System.out.println at various locations with varying characters and variables within your program. For example:
System.out.println(“StudentName: ” + stuName);
System.out.println(“StudentNumber: ” + stuNumber);
Prints out to system window (small black window):
StudentName: joe
StudentNumber: 12345
When the program stops working, view the System window output. Compare this output with your code and the System.out.println statements. Continue this process until you locate the exact error location. It is often useful to print out the values of the for loop index’s.
Error Messages
Understanding the error messages given by JCreator is clearly important, and at first is a cause for much confusion. In my experience as a TA, many students don’t even read the error messages before they asked me to help them debug their code. So make sure you always read these messages and make sure your TA explains what the error messages mean. Sometimes the error messages don’t seem to correspond to the given error. I suppose some errors create others, so it makes pinpointing the error more difficult sometimes.