• 2022-06-07 问题

    Which fragment is an example of inappropriate use of assertions? () A:  assert (!(map.contains(x))); map.add(x); B:  if (x > 0){}else { assert (x==0); } C:  public void aMethod(int x) { assert (x > 0); } D:  assert (invariantCondition()); return retval; E:  switch (x) { case 1: break; case 2: creak; default: assert (x == 0);

    Which fragment is an example of inappropriate use of assertions? () A:  assert (!(map.contains(x))); map.add(x); B:  if (x > 0){}else { assert (x==0); } C:  public void aMethod(int x) { assert (x > 0); } D:  assert (invariantCondition()); return retval; E:  switch (x) { case 1: break; case 2: creak; default: assert (x == 0);

  • 1