Quiz

After the LottoMadness program has soured you on games of chance, play a game of skill by answering the following questions.

Questions

1:

Why are action events called by that name?

  1. They occur in reaction to something else.
  2. They indicate that some kind of action should be taken in response.
  3. They honor cinematic adventurer Action Jackson.
2:

What does this signify as the argument to an addActionListener() method?

  1. This listener should be used when an event occurs.
  2. This event takes precedence over others.
  3. This object will handle the events.
3:

Which component stores user input as integers?

  1. JButton
  2. JTextField
  3. Neither does.

Answers

A1:

b. Action events include the click of a button and the selection of an item from a pull-down menu.

A2:

c. The this keyword refers to the current object. If the name of an object were used as an argument instead of the this statement, that object would receive the events and be expected to handle them.

A3:

c. JTextField and JTextArea components store their values as text, so their values must be converted before they can be used as integers, floating-point numbers, or other non-text values.

      
Comments