Given:
1. public class Donkey {
2. public static void main(String[] args) {
3. boolean assertsOn = false;
4. assert (assertsOn) : assertsOn = true;
5. if(assertsOn) {
6. System.out.println(“assert is on”);
7. }
8. }
9. }
If class Donkey is invoked twice, the first time without assertions enabled, and the second time
with assertions enabled, what are the results?
A.
no output
B.
no output
assert is on
C.
assert is on
D.
no output
An AssertionError is thrown.
E.
assert is on
An AssertionError is thrown.