dcsimg
Assertion in java
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Salima_Lalani
Posted On:   Tuesday, August 20, 2002 05:06 PM

Hi,
The 1.4 programmer certification has included assertions in java. Can anybody tell me what it is about? What exactly assertion mean?

Thanks in advance,
Salima

Re: Assertion in java

Posted By:   chris_moran  
Posted On:   Saturday, August 31, 2002 04:29 PM

Can anyone spot the programmer that has never used C/C++?

Re: Assertion in java

Posted By:   Rob_Eamon  
Posted On:   Tuesday, August 20, 2002 06:14 PM

Assert is a technique normally associated with C/C++ programming to ensure that assumptions made when coding a function/method are true. For example, if the code assumes that a parameter will never be null, the assert statement verifies this and will abort the program if the condition is false.

In C/C++, assert is a macro which is conditionally compiled. During debug/test, asserts are enabled. After testing is complete, and you're reasonably certain your code is working, a "release" build can be made that strips out asserts from the compiled code--reducing the code footprint. Java compilers supporting 1.4 features can be instructed to conditionally remove asserts.

See http://java.sun.com/j2se/1.4/docs/guide/lang/assert.html for more info.

Re: Assertion in java

Posted By:   Lai_Kok  
Posted On:   Tuesday, August 20, 2002 06:01 PM

assertion is a kind of thing similiar like in C++ language whereby you could ascertain certain condition to be always true and if will throw assertion error if the condition is false.
About | Sitemap | Contact