This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
1. The assert system is suitable as a general replacement for the try/catch clause. 2) The assert system is suitable as a general replacement for the if/else clause Both the above statements are false. WHy ? I thought both sounded true
The answer is false because you can turn assertions off. You should never depend on assertions to make your program run -- they should be used during development to insure that unexpected situatioins / variable values do not occur. They are generally turned off in production (it speeds things up). So if you write your code so that it only works if Assertions are turned on... and someone goes and turnst them off... You're in a world of hurt. Check out these two articles in the JavaRanch Newsletter, hopefully they'll give you a better understanding of the correct usage of assertions: Cindy's Segment - Asserting Yourself in Public by Cindy Glass Assertions - Debugging in J2SE 1.4 by Thomas Paul Enjoy! [ August 15, 2003: Message edited by: Jessica Sant ]