Previous Section  < Day Day Up >  Next Section

Quiz

Test whether your Java graphics skills are taking shape by answering the following questions.

Questions

1:

What method is used to change the current color before you draw something in a program?

  1. shiftColor()

  2. setColor()

  3. Could you repeat the question?

2:

If you want to use the height and width of a component to determine how big something should be drawn, what can you use?

  1. A ruler and a friend who's good at math

  2. getHeight() and getWidth()

  3. getSize().height and getSize().width

3:

What societal problem did this hour's first example program call attention to?

  1. Overpopulation

  2. Defaulted student loans

  3. People who compress air in places with signs that clearly indicate it is prohibited, especially restaurants

Answers

A1:

b. You can use the setBackground() method to set the background color of an applet, and you can use the setColor() method of the Graphics class to select the current color.

A2:

c.

A3:

c. Though overpopulation is a pretty big deal, too.

    Previous Section  < Day Day Up >  Next Section