Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt with assertions - Kathy Sierra chapter 10

 
Jacob Sonia
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic