• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Do we assume assertion is disabled or enabled?

 
Shanel Jacob
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, during the exam, do the questions actually tell you if assertion is enabled or disabled (since the "right" answer varies with assumption).
 
Sriram.Narayanan Thiagarajan
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by default assertion is disabled

To enable assertion-awareness at compile time

javac -source 1.4 <FILE_NAME>

To enable assertion-awareness at run time

java -ea <FILE_NAME>
or
java -enableassertions <FILE_NAME>

Refer K&B for various options in it .
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By default assertions are disable at run time.
In question it will be mentioned(assertion enable or disable).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic