Recitation R13 - Enabling Assertions
Spring 2016
CS160: Foundations in Programming
Turning assert statements off and on
One of the great things about assertion statements is the ability to turn on and off functionality. This allows you to create as many as you want and leave them in your code when you turn in your assignment. To enable assertions:
- Go to the Run Configurations.
- Check to make sure the Project: is R13 and the Main class is ProgramCorrectness.
- Select the Arguments tab
- Under VM arguments type -ea. This stands for enable assertions and it turns the assertions on.
To disable assertions, repeat the navigation steps from above and take the -ea out of the VM arguments.
© 2016 CS160 Colorado State University. All Rights Reserved.