|
The Basics of Testing and Debugging
|
|
Prof. David Bernstein |
| Computer Science Department |
| bernstdh@jmu.edu |
print()
that are designed to provide information about the program
while it is executing
public static int calculate(int x, int y)
{
int a, b;
a = 1;
if (x > y)
{
a = 2;
}
x++;
b = y * a;
if (y <= 0)
{
b++;
}
return b;
}
calculate(5, -2)
calculate( 5, 2)
calculate(-2, -1)