wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt with assertions - Kathy Sierra chapter 10 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt with assertions - Kathy Sierra chapter 10" Watch "Doubt with assertions - Kathy Sierra chapter 10" New topic
Author

Doubt with assertions - Kathy Sierra chapter 10

Jacob Sonia
Ranch Hand

Joined: Jun 28, 2009
Posts: 174


if i use
javac -source 6 Antique.java
java Antique

why does it compile...if we specify source 6...aren't assertions enabled by default then
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30116
    
150

Jacob,
Assertions are disabled by default. And the code will compile regardless of whether assertions are enabled. The question then is whether it will run or throw an exception due to the assertion.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Doubt with assertions - Kathy Sierra chapter 10
 
Similar Threads
Do I need to delete source files ?
WA #1.....word association
Keywords in the SCJP exam
K&B Page 814 Q7 Regarding Assertions in Java
Assertion problem