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 in more than one method of a class should be created right after the class statement but before any methods begin.

      
Comments