在NetBeans 7.1中调试Java代码时,如何更改变量的值? [英] How can I change the value of a variable while debugging Java code in NetBeans 7.1?
问题描述
我设置了一个断点,允许我看到一个对象的一个字段中的值。我想改变值然后继续执行,但是我尝试从变量视图编辑值,值字段是灰色的。在调试过程中是否有任何方法来更改变量值?
I have set a breakpoint that allows me to see the value in a field on an object. I'd like to change the value then continue execution, but then I try to edit the value from the variables view, the value field is grayed-out. Is there any way to change variable values while debugging?
推荐答案
还可以更改原始变量和字符串的值in-place in
变量窗口的值列。要更改Object变量的值,可以在菜单Debug选项(Ctrl + F9)下使用Evaluate Expression ...。
It is also possible to change the value of the primitive variables and Strings in-place in the Value column of Variables window. To change values of Object variables, you can use "Evaluate Expression..." under menu Debug option (Ctrl+F9).
这篇关于在NetBeans 7.1中调试Java代码时,如何更改变量的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!