This course will be retired on July 14, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Introducing IntelliJ and Unpacking Packages!
Preview
Video Player
00:00
00:00
00:00
- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
In this video we'll go over the various ways we can walk through our stopped code!
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
We've just seen how to run the debugger.
0:00
Now let's step through
our code line by line.
0:02
There's a tool bar down
here in the lower left and
0:05
it contains controls on how to debug.
0:09
Let's quickly go over each one.
0:11
This first one is the Rerun button,
which would restart the debugging session.
0:14
Next is the Resume button, which
resumes normal execution of the code.
0:20
If there are any more breakpoints,
0:25
then it will run until it
gets to the next break point.
0:27
Then we've got Pause and Stop buttons,
which are pretty self-explanatory.
0:30
Notice that the Pause button is currently
grayed out because we're already paused.
0:35
This next one down here with multiple
circles shows all the breakpoints we
0:40
currently have.
0:44
This can be especially useful when
we're debugging more complex tasks.
0:46
Now let's jump over to
these buttons at the top.
0:50
These control how we
walk through the code.
0:54
The first one takes us to
the current line of execution.
0:57
So if we were in the person class,
maybe on line 11,
1:01
we could use this button to get back
to the line where we're paused.
1:05
These next ones are used to step
through the code in different ways.
1:12
This first one is called Step Over,
1:17
followed by two different Step Into
buttons, and then a Step Out button.
1:19
Step Over, the first one,
will step to the next line to be executed
1:25
after this current line is all done,
which for me is line 9.
1:31
Clicking on this Step Over button would
process everything on our new person line,
1:36
and then it would pause
again right here on line 9.
1:43
Step Into means that we'll step
into the current method call,
1:47
provided there is one on the current line.
1:52
In this case, clicking Step Into
means we would take the debugger into
1:55
the constructor of the person class.
2:00
Let's try that.
2:02
Nice, and if we look to the bottom we can
see that the name parameter is set to Ben.
2:04
And that the name field
hasn't been set yet.
2:10
So let's hit Step Over two times to
bring us to the end of the method.
2:14
And now we can see that
the name field has a value.
2:20
From here, let's use Step Out
to get back to the main class.
2:25
Step Out runs all the code until
the end of the current method and
2:31
then waits for us to make the next move.
2:36
Awesome, now that we've seen
how to use the debugger,
2:38
let's hit the Resume button to
finish running the program.
2:41
Great job learning about IntelliJ.
2:47
I know it might seem overwhelming
at first, but as you can see,
2:49
it's got a lot of features to
make our lives a lot easier.
2:53
Until next time.
2:56
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up