aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Assert questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Assert questions" Watch "Assert questions" New topic
Author

Assert questions

Damien Howard
Ranch Hand

Joined: Apr 01, 2003
Posts: 456
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.
Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3198
    
    2
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


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
Damien Howard
Ranch Hand

Joined: Apr 01, 2003
Posts: 456
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?
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Assert questions
 
Similar Threads
Scoring question
K&B Book Error?
Initialiser Blocks
Question on goto and const
Assertion - what are system classes?