Last name (BLOCK CAPITALS): _______________ First name: __________

Two-character quiz section ID): ______

CSE143

Miniquiz #07 (5 pts)
  July 22, 2003

True or False:

1. ______ In Java, Iterator is a concrete class.

2. ______ In Java, List implements the Collection interface.

3. In your project, you should never directly invoke/call (circle ALL that apply):

    paintComponent() of any JComponent            repaint() of any JComponent            

    draw() of any AbstractVehicle            draw() of any Background            draw() of Graphics2D

4. (Circle one) In lecture, the professor discussed the paintComponent method and noted how you have to trust that the method will be called. This was explicitly described as being an example of ___________ .

    loss of control            inversion of control            belief in a higher programming power

    belief in pair programming            good programming style

5. Look at the following code:

public class someClass {

    private int x;

    public void method1() {
        x = 23;
        try {
            int x = Integer.parseInt("7");
        }
        catch (Exception e) {
        }
        System.out.println(x);
    }
}

Whenever the method is called, '23' is always printed out to the screen instead of '7'. Why?







(Not required) If you have time remaining, answer the following question:

What VERY simple change would you make to the code so that the method would print out '7'?