I'm wondering if there is a way to add a conditional break point in eclipse while debuging. Sample: if city=="New York" 开发者_如何学运维then break.
Yes. Right-click on the breakpoint, select "Breakpoint properties", enable "Conditional" and then enter the condition. Note that city == "New York"
wouldn't be a good condition due to the way equality works in Java, but "New York".equals(city)
would be fine. Note that Eclipse allows simple Boolean conditions like this, and also "suspend when value changes".
Here is the detailed tutorials. http://wiki.eclipse.org/FAQ_How_do_I_set_a_conditional_breakpoint%3F
Open the context menu over a break point on the left bar of the code editor, select "Breakppoint properties..." and "Enable condition"
精彩评论