Debugging a computer program:
2. When you start coding, write a small amount of code, compile it, correct any syntax errors, recompile it, continue until the syntax errors are corrected. Then add another small amount of code (approximately 8 to 10 lines), compile it, etc.
Continue entering code in this fashion until all of the code is entered. In cases where you are entering looping structures, you may want to just get the loop working first (printing the loop variable to check for correct operation). Once the loop is working you can go about including other operations to be performed within the loop.
3. Test modules separately, using driver programs.
4. Test main module separately, using stubs for modules when necessary.
static boolean isDivisor(int dividend, int possibleDivisor)
{
return true; // return dummy value
}
5. Use output to show where your program is in execution (if necessary)
6. Use the compilers error messages to determine approximately where a syntax error is located, then closely examine the offending code, looking for the error.