53,773 views
31 votes
31 votes
Rebecca is creating a method for her class, but wants to make sure that a variable in the method satisfies a conditional phrase. If it doesn’t, she wants the method to return an error and stop the program. She also wants to be able to turn this function on and off. What should she use?

A. this()
B. a void method
C. an exception
D. an assertion

User Arian Shahalami
by
2.8k points

1 Answer

18 votes
18 votes

Answer:

D. an assertion

From PLATO

User Vitalii Korsakov
by
2.3k points