Postconditions

/**
   Deposits money into this account.
   (Postcondition: getBalance() >= 0)
   @param amount the amount of money to deposit
   (Precondition: amount >= 0) */

amount <= getBalance() // this is the way to state a postcondition
amount <= balance // wrong postcondition formulation


Why might you want to add a precondition to a method that you provide for other programmers?

   Answer: Then you don't have to worry about checking for invalid values – it becomes the caller's responsibility.


When you implement a method with a precondition and you notice that the caller did not fulfill the precondition, do you have to notify the caller?

   Answer: No – you can take any action that is convenient for you.