It's not possible with the debugger to not execute parts of the code.
It is however possible to execute extra code and change values on variables so if you need to exclude one row from execution during debug you will have to alter your code to prepare for that kind of debugging.
Copypublic void someMethod() {
int a = 3;
int b = 2;
boolean shouldRun = true;
if (shouldRun) {
a = b + 2;
}
System.out.prinln(a);
}
You would then set a break point that changes the value of shouldRun without stopping execution. It can be done like this.

Note that
- Suspend isn't checked
- Log evaluated expression is used to alter a variable when the break point is hit
It's not possible with the debugger to not execute parts of the code.
It is however possible to execute extra code and change values on variables so if you need to exclude one row from execution during debug you will have to alter your code to prepare for that kind of debugging.
Copypublic void someMethod() {
int a = 3;
int b = 2;
boolean shouldRun = true;
if (shouldRun) {
a = b + 2;
}
System.out.prinln(a);
}
You would then set a break point that changes the value of shouldRun without stopping execution. It can be done like this.

Note that
- Suspend isn't checked
- Log evaluated expression is used to alter a variable when the break point is hit
IntelliJ recently published a blog post about a plugin called Jump to Line that can accomplish this, even though IntelliJ itself doesn't have this functionality. It really is surprising that IntelliJ still doesn't have this functionality, when Visual Studio has had it for so many years!
https://blog.jetbrains.com/idea/2020/08/jump-to-any-line-while-debugging/
intellij idea - how to set debug mode compile and run project one line by one line from the program entry - Stack Overflow
IntelliJ Debugging Cheat Sheet
How to debug boolean method calls with IntelliJ
How to stepback while debugging?
Videos
Hello,
i wrote a debugging cheat sheet for IntelliJ IDE on google docs:
If you use IntelliJ this might be helpful for you.
Heres the link:
https://docs.google.com/document/d/1ZpEqddH3k0TUhzuJq_g_LgQN7mxsORBe22w-qBbDeMo/edit?usp=sharing
Im looking forward to your feedback.
I'm working on an assignment and am having an issue with my boolean calls not working correctly, someone recommended I use a debugger to check when the calls are occurring and what's being passed through.
I'm using the intelliJ IDE and am not sure how I'd debug a boolean method.