posted 8 years ago
Hi .
One of the warning about "Using Assertions Appropriately" is "Don't Use Assert Expressions that Can Cause Side Effects!"
Let me explain what understand from this then you can check my understanding whether is true.
l understand from "Don't Use Assert Expressions that Can Cause Side Effects!" sentence that
public void doStuff() {
assert (modifyThings());
// continues on
}
public boolean modifyThings() {
y = x++;
return true;
}
l understand above code that if assertion is enbled depending that value of "y"(in modifyThings() method) will be changed.
Reverse if assertion is disabled depending that value of "y"(in modifyThings() method) will not be changed.
l am right.
Please help.
Thanks...