How to debug your Java code in IntelliJ
If you are not a paid Medium member you can read it here.
Debugging code can be difficult for newbies sometimes but it is not as difficult as it seems. In this post I will explain debugging in IntelliJ starting from the basics. I will not cover all the features. They are the ones that I use most.
Requirements
There is no requirements for this.
My Motivation
I used to debug my code with System.out.println();
and it was OK for me. I didn't have any complaints about it because I thought using debugging interface does the same thing with a fancy label. Last year, I did an internship and one day, I forgot to remove System.out.println();
in my pull request. It was rejected in the code review and my mentor taught me the basics of debugging. It was a good experience for me although I had difficulty giving up my bad habit. Now, I've completely quitted writing System.out.println();
and explored much about debugging. It's time to share what I've learnt.
1. Setting breakpoints
The most important part of debugging is breakpoints. Breakpoint is the place where you want to pause your program for debugging purposes. When your program pauses at somewhere, you can see many properties of your current scope…