When we are coding, sometimes we want to check if our code is running the way we want it to by using System.out.println(). For example, let's imagine we want to test if a certain number is positive or negative. We could write something like this: if(number < 0) {
System.out.println("The number is negative");
}else {
System.out.println("The number is positive");
} However, this is not the most effective way to debug and test our code. This is because when our code is finished and we want to remove these println statements, we have to go through our whole code and delete them one by one which can be very time consuming and ineffective. Instead of using System.out.println(), experts recommend using breakpoints. Breakpoints allow us to pause our code at a certain line so that we can see the values of the variables at that point in time and test if our code is running the way we want it to. For example, if we wanted to test the same thing as before (whether a certain number is positive or negative), we would set a breakpoint on the line where the variable 'number' is declared and then run our code. Once our code hits the breakpoint, it will pause and we can hover over the 'number' variable to see its value. We can then see whether our code is running correctly based on the value of 'number'. Therefore, breakpoints are much more effective than using System.out.println() because they are less time consuming, allow us to test multiple lines of code at once, and give us more information about the state of our code.