Why is a method having void return type not allowed to be used as an assert expression?
assert expression 1 : expression 2(optional);
Expression 1 must result to a boolean expression, it can be a method call that returns a boolean value.
If you are talking about Expression 2 that is optional. It must be a expression that yields to some value not "void" at all. Because it is a sort of message appended with the AssertionError exception, if assertion fails. It can be any method call that returns something that can be converted to String (most of the Java classes implements toString() method of the Object class), even boolean but not void.