Assertions
Category: Assertions
Author: Marty Stepp and Ruth Anderson
Book Chapter: 5.5
Problem: Assertions
For each of the five points labeled by comments, identify each of the following assertions as being either always true, never true or sometimes true / sometimes false. public static int mystery(int z) { int y = 10; int x = 0; <span class="assertionpoint">// Point A while (z >= y) { <span class="assertionpoint">// Point B if (x <= y) { <span class="assertionpoint">// Point C x++; } z--; <span class="assertionpoint">// Point D } <span class="assertionpoint">// Point E return z; }
1) x <= y
2) y > z
3) x == 11