Quiz

The following questions test your knowledge of applets.

Questions

1:What type of argument is used with the paint() method?
  1. A Graphics object

  2. A Graphics2D object

  3. None

2:Which method is handled right before an applet finishes running?
  1. decline()

  2. destroy()

  3. defenestrate()

3:Why can't all variables needed in an applet be created inside the init() method?
  1. The scope of the variables would be limited to the method only.

  2. Federal legislation prohibits it.

  3. They can be created there without any problems.

Answers

A1: a. The Graphics object keeps track of the behavior and attributes needed to display things on-screen in the applet window. You might create a Graphics2 object inside the method, but it isn't sent as an argument.
A2: b.
A3: a. Variables that are used ...

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.