Review Questions |
5.24 |
Assuming assertions are enabled, which of these assertion statements will throw an error?
Select the two correct answers.
|
5.25 |
Which of the following are valid runtime options?
Select the two correct answers.
|
5.26 |
What is the class name of the exception thrown by an assertion statement?
Select the one correct answer.
|
5.27 |
What can cause an assertion statement to be ignored?
Select the one correct answer.
|
5.28 |
Given the following method, which statements will throw an exception, assuming assertions are enabled?
static int inv(int value) { assert value > -50 : value < 100; return 100/value; } Select the two correct answers.
|
5.29 |
Which runtime options would cause assertions to be enabled for the class org.example.ttp.Bottle?
Select the two correct answers.
|
5.30 |
What will be the result of compiling and running the following code with assertions enabled?
public class TernaryAssertion { public static void assertBounds(int low, int high, int value) { assert ( value > low ? value < high : false ) : (value < high ? "too low" : "too high" ); } public static void main(String[] args) { assertBounds(100, 200, 150); } } Select the one correct answer.
|
5.31 |
Which statements are true about the AssertionError class?
Select the two correct answers.
|
5.32 |
Which of these classes is the direct superclass of AssertionError?
Select the one correct answer.
|
5.33 |
Given the following command, which classes would have assertions enabled?
java -ea -da:com... net.example.LaunchTranslator Select the two correct answers.
|