1 00:00:00,440 --> 00:00:02,930 More often than not, you're going to get bugs. 2 00:00:03,140 --> 00:00:08,450 So it helps to visualize the runtime using breakpoints in this lesson, you're going to learn how to 3 00:00:08,450 --> 00:00:09,590 use breakpoints. 4 00:00:11,820 --> 00:00:16,860 You can access this lesson from the resources if your resources don't include the following path, then 5 00:00:16,860 --> 00:00:19,800 please download the updated resources from GitHub. 6 00:00:27,100 --> 00:00:31,840 All right, inside the breakpoints class, we can start a debugging session to visualize the output 7 00:00:31,840 --> 00:00:33,430 of each variable line by line. 8 00:00:34,240 --> 00:00:37,150 So in this code, click the run and debug option. 9 00:00:39,230 --> 00:00:44,750 And click on credit lines that Jason file, and here you can see the current file that we can launch 10 00:00:44,750 --> 00:00:49,100 the debugger for, it's the file that corresponds to the breakpoints class. 11 00:00:49,520 --> 00:00:52,550 Not that important, just showing you what's going on behind the scenes. 12 00:00:53,270 --> 00:00:59,150 But what we want to do is we're going to place a breakpoint next to each line of code when we launch 13 00:00:59,160 --> 00:01:00,420 the debugger for this file. 14 00:01:00,560 --> 00:01:05,269 What it's going to do is it's going to stop at each break point and allow us to visualize the output 15 00:01:05,269 --> 00:01:06,230 for that line. 16 00:01:06,740 --> 00:01:11,690 Essentially, it's going to allow us to visualize the run time line by line, kind of like the animations 17 00:01:11,690 --> 00:01:16,070 I've been showing you throughout the course, except now we can do it in voice code, which is really 18 00:01:16,070 --> 00:01:16,370 cool. 19 00:01:17,150 --> 00:01:19,490 So without further ado, click launch. 20 00:01:19,490 --> 00:01:20,240 Current file. 21 00:01:29,030 --> 00:01:31,640 Press continue to stop at each breakpoint. 22 00:01:35,530 --> 00:01:41,040 And here in the left pane, you can visualize the output of each variable and long double boolean car 23 00:01:41,040 --> 00:01:45,310 are primitive types and notice that each primitive store is a value. 24 00:01:46,700 --> 00:01:51,260 And once you get to the last break point, if you press continue, it's just going to disappear because 25 00:01:51,270 --> 00:01:52,720 debugging session is over. 26 00:01:53,300 --> 00:01:54,650 So let's restart the session. 27 00:02:01,170 --> 00:02:02,220 Go to the last line. 28 00:02:07,710 --> 00:02:12,120 And a small little trick for you is to step over at the last line if you want to see it. 29 00:02:16,720 --> 00:02:21,250 Now, string is a class type, you can see that the string variable contains an object with a bunch 30 00:02:21,250 --> 00:02:21,880 of fields'. 31 00:02:22,850 --> 00:02:27,570 One of the fields is an array that contains the ASCII representation of each character. 32 00:02:28,040 --> 00:02:33,590 So what you would see is hello, but what's actually being stored is one hundred and four one two one 33 00:02:33,620 --> 00:02:33,920 one. 34 00:02:33,920 --> 00:02:34,400 Oh, wait. 35 00:02:34,730 --> 00:02:37,390 Where each one corresponds to a character. 36 00:02:38,320 --> 00:02:39,890 Again, this isn't that important. 37 00:02:39,910 --> 00:02:44,350 It's just really cool that this code allows us to see exactly how each variable behaves. 38 00:02:51,190 --> 00:02:54,070 In this lesson, you learn to visualize the output of a variable. 39 00:02:55,290 --> 00:03:01,080 You visualized five primitives, each one stores of value, and you visualize the class type variable 40 00:03:01,080 --> 00:03:02,640 which contains an object.