Lecture 39, CS 302-6, December 05

  1. Various things
    1. Program 4

                                                               i.     Let me know by Wednesday if you would like me to assign a partner for you

                                                             ii.     Partners - by Friday, 12/9

    1. Program 3

                                                               i.     Notify drivers will be graded as extra credit

    1. Program 2 regrades

                                                               i.     By tomorrow

                                                             ii.     Contact the grader – me for most of you, but not all of you

                                                            iii.     Email me, even if you’ve already talked to me

                                                           iv.     Note – Test 1 and Test 2 use different maps

  1. Review:
    1. Using Javadocs

                                                               i.     Why emphasize now?  Because you need to use it for Program 4

    1. Finally blocks

                                                               i.     Comes after a try{} or a catch(){}

1.    Two ways…

                                                             ii.     Always executes

                                                            iii.     Useful for closing scanners, printwriters, etc

                                                           iv.     Make sure to think about variable scope when using

1.    Reminder – {} blocks signify nested scope boxes

    1. Exception philosophy

                                                               i.     Creating checked vs unchecked exceptions

  1. Build our own Exceptions
    1. InputVerify.java
    2. InputTooShortException
    3. ContainsA4Exception
  2. Class hierarchy
    1. Inheritance

                                                               i.     Relationship between classes

                                                             ii.     Ultimate goal – save us time/effort

    1. Subclasses and superclasses

                                                               i.     Other terms - parents/children, base class

    1. Extends keyword
    2. Substitution principle

                                                               i.     If your code calls for a superclass, you can use one of its subclasses.

                                                             ii.     Exqample - IOException, FileNotFoundException

    1. More specific classes can still use methods from their parent classes

1.    Example with exceptions – printStackTrace, getMessage

  1. Homework – For Wednesday – Read ch. 9.1-9.4