Next: About this document ...
Up: In the Laboratory: Editing,
Previous: Lab Exercise 2: Generating
Recall that semantic errors cannot be detected
by the compiler. They are errors in the logic of the program that
cause it to do something it is not really supposed to do. For each of
the following errors, try to think about what will happen before you
run the program. Then try to describe the logic error being
committed. Ask yourself what kind of test you might perform to detect
the error (if you didn't already know where it was).
- Button, button, who's got the button? Comment out the
line (by beginning it with double slashes) that contains the
add(clickMe); statement. This is a pretty easy error to detect.
- What's the difference? Put a space before the
exclamation point in ``Click Me!'' in the actionPerformed()
method. This error is a little more subtle than the first one. How
would you detect this error?
That's enough! Feel free to make up your own experiments and
play around some more with the program.
Next: About this document ...
Up: In the Laboratory: Editing,
Previous: Lab Exercise 2: Generating
Ralph Morelli {Faculty}
2002-03-02