• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Assert questions

 
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All, I have some questions on assert that I hope someone can clear up.
First, is the addition of assert the only difference between ver 1.3 and ver 1.4? K&B's book makes it seem that this is the case in their section on assert.
What are system classes? And if the command-line switches when used without arguments enable and disable assert in all classes except system classes then why wouldn't the following from K&B's book on page 263 table 4-4 be redundant, or am I not understanding something correctly?
java -ea -dsa
Also is there a way to enable assert in system classes or would this be a silly question if I knew what was meant by system classes?
Thanks for the help guys and gals.
 
Enthuware Software Support
Posts: 4810
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Damien Howard:
First, is the addition of assert the only difference between ver 1.3 and ver 1.4? K&B's book makes it seem that this is the case in their section on assert.


There are many differences in 1.3 and 1.4
However, w.r.t. SCJP1.4, assertions is the only new thing.


What are system classes?


Classes in that come standard with the JDK. Mainly, the java.* packages.


And if the command-line switches when used without arguments enable and disable assert in all classes except system classes then why wouldn't the following from K&B's book on page 263 table 4-4 be redundant, or am I not understanding something correctly?
java -ea -dsa


I think if you use just the above above combination of switches (-ea -dsa), then -dsa is redundant really. But if you want to enable the assertions only for certain system packages and disable for others, then you would use something like:
-esa:java.lang -dsa


Also is there a way to enable assert in system classes or would this be a silly question if I knew what was meant by system classes?


That's not a silly question at all. As I mentioned above, you have -esa option for enabling assertion in system classes. If you do java -help, you'll see all the various options that java supports. Try it, it will be very enlightening if you haven't it before
 
Damien Howard
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Paul.
One more question.
Why would you want to use the assert in the systems classes? We can't edit the classes right? Only subclass them, or am I wrong?
 
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assertions are a new additions. But with respect to the SCJP there has been a change in the collections as well.
[ May 17, 2003: Message edited by: Anupam Sinha ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic