2 Minutes To Code (β Version)

Debugging with Eclipse - 2 minute tutorial

How to Step in, out and over java statements when breakpoint is hit

After a breakpoint is hit, you can ask jvm to execute one line of code at a time using the step-over and step-in/step-out buttons (highlighted in the first image below).

Let's see what these means :
  1. Step-over : Advances to the next line of code in present class

  2. Step-in : If the current line of code contains a method call, then it will move inside that method (in same or a different class)

  3. Step-out : After you step-in a class, you can return to the original place, by using step-out

Let's see these in images :

This image shows the step-in, step-out & step-over buttons (enclosed in red box). Notice that execution is paused at line number 21 of Workshop.java which contains a call to method paintCars(); In the image below let's see what happens when you click step-in and over in the other images below.



When you hit step-over, it will move to next line of code in present class. After line number 21 of Worshop.java, rhe while loop ends (line number 22). So, the control moves to the beginning of while loop (line number 19) and again execution is paused.



When you hit step-in when execution is paused at line number 21, debugger will take you inside paintCars() method and execution will halt there. Contrast this to the behaiour of step-over above. To retunr from paintCars() method to the initial point, click step-out.