nit*_*sua 1 java eclipse debugging
我很好奇Java中是否有关键字允许eclipse或IDE停止运行代码并在代码到达特定点时启动调试器.
我知道断点对于这个特定的问题非常有用,但是我希望只有在达到特定条件时才开始调试程序,并且这个条件是程序没有定期检查的,所以我必须编程它纯粹用于调试.
例如,
if(condition_is_met){
//throw debugger and begin to step through here
}
Run Code Online (Sandbox Code Playgroud)
我能想到的另一种方法是......
if(condition_is_met){
System.out.println("Something"); //Then set a breakpoint here in Eclipse.
}
Run Code Online (Sandbox Code Playgroud)
这看起来很麻烦,这意味着我在以后清理代码时可能会错过它.Java是否有关键字,可能类似于Javascript的debugger关键字?