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);
正确答案:C
答案解析:有
微信扫一扫手机做题