1 00:00:00,000 --> 00:00:02,435 We've just seen how to run the debugger. 2 00:00:02,435 --> 00:00:05,665 Now let's step through our code line by line. 3 00:00:05,665 --> 00:00:09,160 There's a tool bar down here in the lower left and 4 00:00:09,160 --> 00:00:11,897 it contains controls on how to debug. 5 00:00:11,897 --> 00:00:14,727 Let's quickly go over each one. 6 00:00:14,727 --> 00:00:20,060 This first one is the Rerun button, which would restart the debugging session. 7 00:00:20,060 --> 00:00:25,125 Next is the Resume button, which resumes normal execution of the code. 8 00:00:25,125 --> 00:00:27,210 If there are any more breakpoints, 9 00:00:27,210 --> 00:00:30,346 then it will run until it gets to the next break point. 10 00:00:30,346 --> 00:00:35,314 Then we've got Pause and Stop buttons, which are pretty self-explanatory. 11 00:00:35,314 --> 00:00:40,081 Notice that the Pause button is currently grayed out because we're already paused. 12 00:00:40,081 --> 00:00:44,612 This next one down here with multiple circles shows all the breakpoints we 13 00:00:44,612 --> 00:00:46,280 currently have. 14 00:00:46,280 --> 00:00:50,550 This can be especially useful when we're debugging more complex tasks. 15 00:00:50,550 --> 00:00:52,900 Now let's jump over to these buttons at the top. 16 00:00:54,080 --> 00:00:56,280 These control how we walk through the code. 17 00:00:57,520 --> 00:01:01,110 The first one takes us to the current line of execution. 18 00:01:01,110 --> 00:01:05,650 So if we were in the person class, maybe on line 11, 19 00:01:05,650 --> 00:01:12,550 we could use this button to get back to the line where we're paused. 20 00:01:12,550 --> 00:01:17,060 These next ones are used to step through the code in different ways. 21 00:01:17,060 --> 00:01:19,885 This first one is called Step Over, 22 00:01:19,885 --> 00:01:25,737 followed by two different Step Into buttons, and then a Step Out button. 23 00:01:25,737 --> 00:01:31,450 Step Over, the first one, will step to the next line to be executed 24 00:01:31,450 --> 00:01:36,666 after this current line is all done, which for me is line 9. 25 00:01:36,666 --> 00:01:43,260 Clicking on this Step Over button would process everything on our new person line, 26 00:01:43,260 --> 00:01:47,324 and then it would pause again right here on line 9. 27 00:01:47,324 --> 00:01:52,094 Step Into means that we'll step into the current method call, 28 00:01:52,094 --> 00:01:55,336 provided there is one on the current line. 29 00:01:55,336 --> 00:02:00,148 In this case, clicking Step Into means we would take the debugger into 30 00:02:00,148 --> 00:02:02,775 the constructor of the person class. 31 00:02:02,775 --> 00:02:04,786 Let's try that. 32 00:02:04,786 --> 00:02:10,901 Nice, and if we look to the bottom we can see that the name parameter is set to Ben. 33 00:02:10,901 --> 00:02:14,587 And that the name field hasn't been set yet. 34 00:02:14,587 --> 00:02:20,270 So let's hit Step Over two times to bring us to the end of the method. 35 00:02:20,270 --> 00:02:25,038 And now we can see that the name field has a value. 36 00:02:25,038 --> 00:02:30,460 From here, let's use Step Out to get back to the main class. 37 00:02:31,620 --> 00:02:36,130 Step Out runs all the code until the end of the current method and 38 00:02:36,130 --> 00:02:38,830 then waits for us to make the next move. 39 00:02:38,830 --> 00:02:41,616 Awesome, now that we've seen how to use the debugger, 40 00:02:41,616 --> 00:02:44,651 let's hit the Resume button to finish running the program. 41 00:02:47,088 --> 00:02:49,265 Great job learning about IntelliJ. 42 00:02:49,265 --> 00:02:53,247 I know it might seem overwhelming at first, but as you can see, 43 00:02:53,247 --> 00:02:56,869 it's got a lot of features to make our lives a lot easier. 44 00:02:56,869 --> 00:02:58,025 Until next time.