Skip to content

Week 04: Types and Exceptions

  • Wrapper Class

    After this unit, students should

    • be aware that Java provides wrapper classes around the primitive types.
    • be aware that Java will transparently and automatically box and unbox between primitive types and their corresponding wrapper classes.
  • Runtime Class Mismatch

    After this unit, students should

    • understand the need for narrowing type conversion and typecasting when writing code that depends on higher-level abstraction.
    • understand the possibility of encountering run-time errors if typecasting is not done properly.
  • Variance

    After this unit, students should

    • understand the definition of the variance of types: covariant, contravariant, and invariant.
    • be aware that the Java array is covariant and how it could lead to run-time errors that cannot be caught during compile time.
  • Exceptions

    After this unit, students should

    • understand the handling of Java exceptions and how to use the try-catch-finally blocks.
    • understand the hierarchy of exception classes and the difference between checked and unchecked exceptions.
    • be able to create new types of exceptions.
    • understand the control flow of exceptions.
    • be aware of good practices for exception handling.