This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

assertion

 
anushree ari
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to enable or disable the assertion form the source code itself?
explain me,
thx
 
Dan Chisholm
Ranch Hand
Posts: 1865
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can disable the program if assertions are not enabled using something like the following.

If assertions are not enabled the assertsEnabled boolean remains false and the RuntimeException is thrown.
 
Manish Hatwalne
Ranch Hand
Posts: 2591
Android Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assertions can be enabled or disabled programmatically, have a look at ClassLoader class documentation.
HTH,
- Manish
 
Albert Lee
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use // or /* */ to disable assersion statement.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic