Do not use assert expressions that can cause side effects!

Do not use assert expressions that can cause side effects!

The following would be a very bad idea:

public void doStuff() {
assert (modifyThings());
// continues on
}
public boolean modifyThings() {
x++ = y;
return true;
}

The rule is: An assert expression should leave the program in the same state it was in before the expression!

By:UMANG
Date:2002-03-09 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related scjp1.5 chap4 Links

scjp1.5 chap4 interview questions and answers for experienced and fresher