| 
 
 |   | 
Blob b = new Blob();
Error e = ci.m();
if (e.status == Error.ok) { ... }
void m(args, Error error) { ... }
ci.m(..., e)
if (e.status != Error.ok) { ... }
ci.m();
if (error.status != Error.ok) { ... }
int main () { ci.f() }              
int f() { ci.g() }         
int g() { if (b) ci.g() }          
main() is called, and e() calls f().
    
f() then calls g().
    
f() and g() return.
    
main() returns and the program ends.
  

throw statement throws exceptions.
    try block delimits exception handling.
    catch block catches exceptions.
    
throw Statementthrow statement signals (throws, raises) an exception:
throwexception-ref;
return in syntax and semantics.
    
throw new NullPointerException(); final NullPointerException e = new NullPointerException(); throw e;
catch Blockcatch (ex-type ex-name) {body}
catch (ExceptionType e) {
  // blah blah blah
  }
try Blocktry {body}
try { body }
catch ( ex-type ex-name ) { body }
catch ( ex-type ex-name ) { body }
// and so on
| 
 | 
 
 | 
catch body,
   continue after the try-catch statement.

| 
 
 | 
 
 | 
try { 
  // state set-up
  ci.g()
  // state tear-down
  }
catch (...) { ... }
catch (...) { ... }
ci.g()’s exception interrupts state tear-down. 
    
finally Blocks
finally { code }
is always executed, exception or not, exception handled or not.
try { 
  // state set-up
  ci.g()
  }
catch (...) { ... }
catch (...) { ... }
finally { // state tear-down }
| 
 
 | 
 
 | 
 
 | 
| none | handled | propagated | 

Throwable AncestorThrowable class is the top of the exception
  hierarchy.
  Throwable(String message, Throwable cause) Throwable(String message) Throwable(Throwable cause) Throwable()
Error ClassThrowable child Error defines abnormal
  conditions.
    
Error children include VirtualMachineError and AssertionError.
  
Exception ClassThrowable child Exception defines
  undesirable conditions the application should handle.
    
Exception is a useful catch-all in a catch block.
  Exception descendants.
    
Exception ChildrenException child IOException defines
  undesirable conditions related to input-output operations.
    FileNotFoundException and
    EOFException. 
    
Exception child RuntimeException defines
  undesirable conditions related to non-I/O execution.
    ClassCastExcepton and
    NullPointerException. 
    
| 
 
 | Throwable: exception root.
 
 
 | 
throws Clausethrows ex [ , ex ]...
String read()
throws IOException { ... }
throws
throws clause doesn’t take part in determining the override.
  
class RedException extends Exception { ... }
class BlueException extends Exception { ... }
class p
  int moo() throws RedException { ... }
class c1 extends p
  int moo() 
  throws RedException, BlueException  { ... }
class c2 extends p
  int moo() throws Exception { ... }
class c3 extends p
  int moo() { ... }
@throws tag.
  
| 
 | f()’s exceptions are masked.
 
 | 
Exceptions thrown during execution (count exception): 360 java.lang.StringIndexOutOfBoundsException 1771 java.lang.NullPointerException 36 java.lang.RuntimeException- The cause.
// TODO REMOVE ALL STACK TRACES!!!! catch(StringIndexOutOfBoundsException f) { } catch(NullPointerException f) { }