This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

assertion

 
anushree ari
Ranch Hand
Posts: 98
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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