4.7 Testing and Debugging | 195through the algorithm and the code, tracing the execution of the application, and devel-
oping a thorough test strategy, you should be able to avoid, or at least quickly locate, se-
mantic errors in your code.
Figure 4.9 illustrates the testing process we’ve been discussing. It shows where syn-
tax and semantic errors occur and in which phase they can be corrected.Testing and Debugging Hints1.Java has three pairs of operators that are similar in appearance but different
in effect: ==and =,&&and &, and ||and |. Double-check all of your logical
expressions to make sure you’re using the “equals-equals,” “and-and,” and
“or-or” operators. Then check them again to confirm that you didn’t double
type the <or >operators.
2.If you use extra parentheses for clarity, make sure that the opening and clos-
ing parentheses match up. To verify that parentheses are properly paired,Phase Result Testing Technique Type of ErrorProblem solving Algorithm Alwalk-througorithmgh SemanticImplementation Coded program TrCode walk-throuace gh, SSyemantintaxcCompilation Object program Compiler-error messagenerateges d SyntaxExecution Output Implementest plan t TypoAlgorithm semantigraphical semantic cFigure 4.9 Testing Process