Finding And Fixing Errors

 

Note:  Please keep the programs that you create today, in case you have a question about your grades for the ICEs at the end of the quarter. When you're working with a partner, each person should save their own, individual copy.

 

ICE #5: Finding & Fixing Errors

 

Writing programs involves finding and correcting a variety of errors. As a programmer, you will need to get comfortable with this “debugging” process. Your text mentions three types of errors: compile time, run-time and intent errors. Take a closer look at the compile-time errors.

 

ICE #5.1: Create your own compile-time errors

 

Open one of the programs from the first lecture. Make changes in the text and see which ones introduce errors – for example, add characters (letters, numbers, etc), delete characters, add white space (tabs, spaces, and the return key), change the case of characters, etc. After each change, re-compile the code and see if an error occurs. Make a note of what Java considered errors and what it doesn't.

 

ICE #5.2: Correct several compile-time errors

           

Download the FindErrors.java file, which is provided for you on the course website.  You should record each and every error that you find in your own copy of the Program Debug Table (which you should download from the course website).

Try to follow this debugging strategy (listed in your text) to find and correct the syntax errors in the file.

 

1.   compile the program to get a list of errors;

2.   fix the most obvious errors, beginning with the first error reported,

3.   compile the program again to get a revised list of the remaining errors.

 

You should also save your own personal copy of the Program Debug Table, and record the errors that you find in that. 

 

Note: It’s always useful to view line numbers (because jGRASP tells us which line a syntax error is on).  You can get jGRASP to show line numbers using the
View àLine Numbers menu item; you will need to do this for each and every file you open.