• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Assertion question (in programmer's guide to Java)

 
blacksmith
Posts: 979
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 979
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Hang a left on main. Then read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic