Recitation R19
- Eclipse Debugging, Start P6
Fall 2013
CS160: Foundations in Programming
The purpose of this lab is to:
- Get started on P6
- Learn how to use Eclipse for debugging
PART A - Getting started on P6
See the P6 assignment on the Progress tab on the course website for instructions.
Your TA will make sure you have P6 setup, and help will be available for questions
related to P6.
PART B - Debugging With Eclipse
Download the Debugging.java into your R19 source folder, and open it in Eclipse.
The TA will explain the following debug commands:
- Step Over, which executes the current line of code, and moves on to the next.
- This is useful for simple statements like: int sum = 0;
- Step Into, which (if possible) steps into background code of that line.
- This is useful for exloring method calls like: double average = computeAverage(arrayInts);
- Step Return, which executes all code through to the return of the method, and comes back to the line where the method was called.
- This is useful for skipping over the remaining portions of a function you steped into.
Spend the rest of the time fixing the 4 errors in Debugging.java.
Set breakpoints earlier in the code so that you can explore the behavior of the program
before it breaks, and hone in on the problematic code.
Remember that not all errors break the program, and some are more subtle than others.
The TA will discuss how to examine data, another useful debugging feature.
Show your fixed Debugging.java program to the TA for grading and to get credit for this portion of the lab.
© 2013 CS160 Colorado State University. All Rights Reserved.