Could someone answer a Quick java question?

What would be the definition for a post-condition x=0 in this class. I need help with the last part of an assignment and I would much appreciate it. I assume it is: x = 0; but I think that is just too simple.

/*Class FirstMove

private int x;
private static int count;

public FirstMove()



  • In computer programming, a postcondition is a condition or predicate that must always be true just after the execution of some section of code or after an operation in a formal specification. Postconditions are sometimes tested using assertions within the code itself.

    For example: The result of a factorial is always an integer and greater than or equal to 1. So a program that calculates the factorial of an input number would have postconditions that the result after the calculation be an integer and that it be greater than or equal to 1.

    Another example: a program that calculates the square root of an input number might have the postconditions that the result be a number and that its square be equal to the input. (Wikipedia)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion