An exercise about Assertion
Here's an exercise about Assertion:
In the following code, which lines do not use assertions appropriately?
class AssertDemo{
publicstatic Boolean message(){
System.out.println("Error!!");
returnnew Boolean("true");
}
publicstaticvoid main(String[] args){
boolean b =false;//line 11
assert b : message();//line 13
int x = -5;
assert (x+1)>0;//line 14
assert x>0 : (x = x *-1);//line 15
while(true){
System.out.println(x);
assert x-- >0;//line 19
}
}
}
Select multiple options:
A line 11
B line 13
C line 14
D line 15
E line 19
What would be your answers?

