What are Preconditions and Postconditions?
The precondition statement indicates what must be true before the function is called. If you violate this condition, then the results are totally unpredictable.
The postcondition statement indicates what will be true when the function finishes its work.
You will notice that AP questions are often written with Precondition and Postcondition comments.
Example:
/** * Preccondition: num1 is an integer >= 0 * Postcondition: num1 factorial is returned */ public int justTheFact(int num1) { int fact = 1; for (int i = 1; i <= num1; i++) { fact *= i; } return fact; }