Sponsored Link •
|
Advertisement
|
Says most time contract should be fulfilled, otherwise its an "optional clause".
Exception Safety: an exception should mean that the object is still usable, unless otherwise indicated in the semantics. I.e., when I ask an object to perform a service and the object throws an exception back at me, I want to be confident that I can subsequently ask the object to do something else for me, or the same thing again later, etc. Gives an opportunity to mention finally clauses, which are executed as exceptions propagate up the stack.
charAt(int index)
pre-condition: 0 <= index <
length()
-1
to charAt()
, you'll get an
(unchecked) StringIndexOutOfBoundsException
String
is somehow unable
to meet the post-conditions and invariants, it will also throw an
exception.