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 ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.