Wednesday, October 12, 2011

Java Review: Tuesday, October 12, 2011

Java Run-time Exceptions


  • Class IllegalStateException
  • example
    • throw new IllegalStateException();
  • use to catch programming development errors.
  • exception should never occur unless there is a programming error.
  • Class RuntimeException
  • not checked
  • not extra code
  • danger of being a 'lazy programmer'
  • can use to side step catch and specify requirements
  • Runtime exceptions represent problems that are the result of programming problems
  • If the client can reasonable be expected to recover from an exception, make it a checked exception
Garbage Collection in Java VMs


  • Big memory
    • works with
      • JVMs
      • HotSpot
      • IBM JDK
      • JRockit
      • what about Dalvik?
    • off-heap store
      • not subject to Java GC
    • Terracotta's tiered cache
    • Enterprise Ehcache
    • store up to a terabyte in the off-heap
  • Android, designing from performance
  • requesting GC
    • System.gc();
  • no guarantee it will run

Java Constants and Conditional Compile


  • No textual preprocessor
  • constants and conditional compilation
  • use public static final boolean constant for  a regular if statement in regular code
  • Have class using the constant interface implement the constant interface



No comments:

Post a Comment