Quiz 6 (Exercises from Chap. 9)

  1. (R9.16 Horstmann) Consider this top-level and inner class. Which variables can the f method access?
    public class T
    {
       private int t ;
    
       public void m(final int x, int y)
       {
          int a ; 
          final int b ;
    
          //INNER CLASS
          class C implements I
          {
             public void f()
             {
                 ...
             }
          }
          //MORE LOCAL VARIABLES
          final int c ;
       }
       private int x ;
    }
    
  2. A Timer object is ticking, and with every tick it sends a message to an object of the following type: ________________________ .
  3. The message that a Timer object sends to its listener object is the following: _______________________________.
  4. Circle which of the following are objects (as opposed to messages):
  5. Connect the correct pairs.
    event                                    where it happened
    event listener                           the thing that reacts to the news
    event source                             the news or notification