File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes enableassertions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "enableassertions" Watch "enableassertions" New topic
Author

enableassertions

Balaji Bang
Ranch Hand

Joined: Apr 23, 2007
Posts: 180
I have seen enabling assertions at runtime :

java -ea

Can we enable asertions at compile time . if so is it the way???

javac -ea
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Can we enable asertions at compile time

What do you expect to happen ?


[My Blog]
All roads lead to JavaRanch
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
If you want to set it in an IDE, this might help.
Balaji Bang
Ranch Hand

Joined: Apr 23, 2007
Posts: 180
I am asking this question in Exam point of view.

How to enable assertions at compile time???

javac -ea (is this correct???)
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9304
    
  17

You can't enable or disable assertions at compile time. They are a runtime concept. Your assert code will get compiled always, you cannot skip it...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: enableassertions