[자바질문]assert
물보라
2023.04.01
Which fragment is an example of inappropriate use of assertions?a. assert(!(map.contains(x)));
map.add(x);
b. if (x0) {
}else{
assert(x==0)
}
c. public void aMethod(int x){
assert(x0);
}
d. assert(invariantCondition());
return retval;
e. switch(x){
case 1 : break;
case 2: creak;
default : assert(x == 0);
}dump에서 위의 답이 부적당하다고 하는데요. 왜 부적당한지 도저히 모르겠습니다.
assert:boolean으로 오는 건 저도 아는데요.
왜 틀린걸까요?
고수님들 가르쳐 주시면 감사합니다.
-
해찬나래
죄송합니다. 위의 강좌는 제가 많이 읽어봐서 이해를 했는데요. 모르겠습니다.