To Documents
Debugging Checklist
Data Declaration and Initialization
- Any undeclared variables?
- Any improperly uninitialized variables?
- Default variable values understood?
- Variables of correct datatype?
- Correct size of integer variable used (byte, short, int or long)?
- Any variables with similar names confused?
Computation
- String subscripts within bounds?
- Any non-integer string subscripts?
- Off-by-one errors in indexing or subscripting operations?
- Computations on nonarithmetic variables?
- Mixed-mode computations?
- Computations on variables of diffent lengths?
- Intermediate result overflow or underflow?
- Division by zero?
- Floating point inaccuracies?
- Operator precedence understood?
- Integer divisions correct?
Comparisons
- Comparison relationships correct?
- Is = used instead of ==?
- Floating point comparisons correct?
- Boolean expressions correct?
- Improper comparisons of floating point values
- Operator precedence understood?
Control Flow
- Are all cases covered in if or switch statements
- Should there be a default case in if or switch statement?
- Are break statements omitted in switch statement?
- Is if statement used when if..else should be used or
vice versa?
- Will each loop terminate?
- Will program terminate?
- Any loop bypasses because of entry conditions?
- Are possible loop fall-throughs correct?
- Any off-by-one iteration errors?
- Are { and } correctly placed?
- Any misplaced semicolons, for example
for(i = 0; i <= 100; i++);
System.out.println(i);
Method Calls
- Are all method names spelled correctly?
- Are all method names capitalized correctly?
- Is the number of arguments correct?
- Are the types of the arguments correct?
- Is the order of the arguments correct?
- Is the package containing the method imported correctly?
Input/Output
- Are Scanner objects calls correct?
- Is System.out.print used when System.out.println is appropriate
or vice versa?
- Is format string correct in System.out.printf?
- Input checked for validity?
- Any textual or grammatical errors in output?
Other Checks
- Any warning messages?
- Are import statements correct?