aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Assertion question (in programmer's guide to Java) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Assertion question (in programmer Watch "Assertion question (in programmer New topic
Author

Assertion question (in programmer's guide to Java)

Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hello,
I have the following problem:
Question 5.33 (chapter control flow, exception handling
and assertions)of the Programmers Guide To Java
(Mughal,Rasmussen) states that the following command:
java -ea -da:com... net.example.LaunchTranslator
is said to enable the assertions for the classes
dot.com.Boom and net.example.LaunchTranslator.
And it explains that: �The command line enables assertions for
all non-system classes, except for those in the com package or
one of its subpackages. Assertions are not enabled for the system
classes in (b) and (e)� (where (b) and (e) are respectively java.lang.String and java.lang.AssertionError.
In Kathy and Bert�s guide on page 263 in the table 4-4
it states that the command
java �ea �dsa enables
enables assertions in general, but disables assertions
in system classes.
Since assertions are disabled at runtime by default
and �ea enables assertions in general, why does the
Programmer�s guide to Java say that �Assertions are
not enabled for the system classes...�
Who's right?
Can anyone help? Thanks,
Gian Franco


"Eppur si muove!"
Jayant Kulkarni
Ranch Hand

Joined: Dec 02, 2003
Posts: 56
Hi Gian,
The explanation what I think is -
If you see the option with java command it says ,
-ea: This will enable all asertions
-esa: will enable system assertions.
Hence -ea switch by default enable assertion for all non-system classes.
For the example " java -ea -da:com... net.example.LaunchTranslator "
If you exclude the system classes from the given choices, only point a,c,d are remaining. Out of that the command specifically tell to not enable assertion for com(com.example.Transaltor) package, hence the remaining choices c & d are the possible answers.
Hope you got some idea clear.
Thank you,
Jayanta
[ January 13, 2004: Message edited by: Jayant Kulkarni ]
Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Thanks,
The example in Kathy and Bert�s guide on page 263
java �ea �dsa
confused me, because system assertions are disabled
by default so why include -dsa if -ea enables only
non-system assertions?
Is -dsa redundant in this case?
Gian Franco
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Assertion question (in programmer's guide to Java)