This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes How can i use assertions in java? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How can i use assertions in java?" Watch "How can i use assertions in java?" New topic
Author

How can i use assertions in java?

Ammar Salem
Ranch Hand

Joined: Dec 29, 2007
Posts: 60
Hello guys, i need to know what are Assertions and how they differ from exceptions,why do we need them? i really need help? my book doesnt help much.
Ammar


****************************<br />For Some Dreams.....<br />One Lifetime Is Not Enough.<br />****************************
Jilesh Lakhani
Ranch Hand

Joined: Jul 26, 2006
Posts: 49

http://java.sun.com/developer/technicalArticles/JavaLP/assertions/


-Jilesh
Universe and Knowledge has no bounderies
camilo lopes
Ranch Hand

Joined: Aug 08, 2007
Posts: 202
do you use assert only for test if one line of your code is error or was config for false.
Assert not can to be use in place of IF. Assert is a good programming practice.
example:


Brazil - Sun Certified Java Programmer - SCJP 5
http://www.camilolopes.com/ About Java - Update every Week.
Guide SCJP - tips that you need know http://blog.camilolopes.com.br/livrosrevistaspalestras/
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How can i use assertions in java?
 
Similar Threads
moving from 1.2 to 1.4 exam
Assertions
How to enable assertions?
enabling & disabling assertions programatically
how to enable assertions in eclipse