# Exercise 4: Stepping Through a Method

Stepping through your code is another way to get to the line that is causing a problem. In this exercise, you will learn to step through code and track the changes in variable values in the Threads/Stack window. You will also learn how to remove a breakpoint.

1. Click the Over button in the Edit/Debug toolbar.
   Java WorkShop executes one source line and stops in:

   `If (Math.random() < 0.5) {`

   The source editor highlights the line with the breakpoint in red, and the line in which program execution stopped in green. If the line had been a method call, the Step Over command would run to the next line in the program. If the line had been a method call and you issued the Step Into command, Java WorkShop would execute the first statement of the method and stop.

   The Threads/Stack window shows the current state of the program and its data. For example, `Blink.paint` now indicates it is stopped in line 49.

2. Click the Over button two more times and watch how the debugger steps through your program.
3. In the source editor, move the pointer to line 45, which has a breakpoint.
4. Click the Breakpoint button.
   Java WorkShop removes the breakpoint.

Next lesson:

  Exercise 5: Evaluating Variables