Code: Select all
public void assertTest(List v) { assert v.size() == 10 : v.add("hello"); }
Also, in the explanation, it is said thatInvalid because boolean : void does not satisfy <boolean_expression> : <any_expression_but_void>
But v is a List and add() method returns a boolean, not void. So option 5 is actually valid.Also, v.add(...) returns void. So option 5 is not valid.
And one more thing: the explanation also contains this:
But we do not have Vector objects in this option, we have List objects.Option b is invalid because the first operand must be a boolean but here it is a Vector object.