Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

Do use assertions to validate arguments to a private method.
If we wrinte a private method , we almost certainly wrote any code that calls it,when we assume that the logic in code calling our private method is correct.
     private void doMore(int x) {
assert (x > 0);
// do things with x
}
      The only method in the prg diff that matters between the preceding example and the one before it is the access modifier.