什么"空操作员"警告(翻译自俄语)在netbeans中意味着什么?
for(int v = 1; v <= n; v++) {
int parent = in.nextInt();
if(parent == 0);
root = v;
}
Run Code Online (Sandbox Code Playgroud)
您有一个不必要且危险的分号(;),它会在警告弹出的行中更改您的程序流.
分号是一个空语句,因此root = v无论是否都将执行parent == 0.