from Sierra and Bates.
Which of the following invocations will run without exception? (Choose all that apply.)
A.
java Motel13
B. java -ea Motel13
C. java -da:Hotel Motel13
D. java -da:Motel13 Motel13
E. java -ea -da:Hotel Motel13
F. java -ea -da:Motel13 Motel13
Answer (for Objective 2.3):
A, C, D, and F are correct. When assertions are enabled, the Motel13 class will throw
an AssertionError, the Hotel class will not. Invocations A, C, and D do not enable
assertions for Motel13. F is correct because although assertions were enabled, the "–da"
switch selectively disabled assertions for the Motel13 class.
B and E are incorrect because assertions are enabled for Motel13.
Why is E not a correct answer? I read "java -ea -da:Hotel Motel13" as enable assertions for all classes and disable assertions for classes Hotel and Motel13.
Thanks.
Matt