Do toString side effects get applied in java debugging?
问题 When debuggind java code in eclipse, if you click on one of the variable names, that object gets printed. The object's toString() method is used to print it. If some toString method has a side effect and I click on a variable of that type, will the side effects of its toString get applied (and doubtlessly mess everything up)? 回答1: I think you answered your own question. Any time you call toString , in debugging or otherwise, all side effects will occur. This is exactly why you should avoid