This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 30057
    
149

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
 
wood burning stoves
 
subject: Doubt with assertions - Kathy Sierra chapter 10
 
Similar Threads
Do I need to delete source files ?
Keywords in the SCJP exam
K&B Page 814 Q7 Regarding Assertions in Java
Assertion problem
WA #1.....word association