Lesson 11Debugging
In this lesson, we will build on what we learned in Lesson 3 and take a closer look at how to debug a program. Using the code from the original WindowMaster program, we'll review how to set breakpoints and learn more about how to debug, including how to execute the program in debug mode, step through the program, and examine the values of variables while the program is executing.
CREATING A FILE TO DEBUG
In this lesson, we are going to look a little deeper into the debugger and how it works. It is worth emphasizing that the debugger is a really valuable tool. When people are starting out in development, they often overlook this fact. But it is one of the most important tools in our toolbox. It is one of the ways that the IDE, whether it be NetBeans or another program, can help pinpoint the problems that you are having in your code.
When we write code, we believe we know what it is doing because we believe we wrote it the right way, so it can be frustrating when it is not doing what we want it to do. Always keep in mind that the computer only does what we tell it to do. Generally speaking, if our program isn't working right, it's nearly always due to something that we wrote.
A small percentage of the time, an error is in somebody else's code that we are using. If you ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access