为什么IntelliJ中的调试器正在停止,即使条件不正确?

时间:2017-10-12 05:07:26

标签: debugging intellij-idea

我有以下示例代码,因为我无法粘贴原始代码。我试图把条件断点 hello.fname.equals("hellow") ,注意这里我提到断点只有在匹配hellow时才必须停止,但它也会因为错误状态而停止。

我已单独评估条件并返回false。那为什么它会因为错误的情况而停止呢?

class Hello{
    String fname;
    String lname;

    public Hello(String fname, String lname) {
        this.fname = fname;
        this.lname = lname;
    }

}
public class SOTest {
    public static void main(String[] args) {
        Hello hello = new Hello("hello", "world");
        foo(hello);
    }

    private static void foo(Hello hello) {
        long startTime = System.currentTimeMillis();
        String test = "test";
        if(hello.fname.equals("hello")){
            System.out.println("hello");
        }
        if(hello.lname.equals("world")){
            System.out.println("world");
        }
    }


}

0 个答案:

没有答案