No. Class diagrams do not show behavior, but only structure. To show the behavior, you can use sequence diagrams, and it is shown that in the sequence diagram a rectangle is shown, which in the upper corner records the condition, and inside it describes the operation that occurs if the condition is true. You can read here for more information: http://en.wikipedia.org/wiki/Sequence_diagram